Reading indicator values in scripts
In DAS Trader Pro the indicators are called "studies," so I will be using the name "studies" from now on.
Everybody knows the studies like moving averages or VWAP. Below I will describe how those studies can be read and used in DAS Trader Pro scripts.
To read the value of a study, there is a dedicated function called getstudyval()
getstudyval()
Get the last value of a study by name, or get the study's info string by bar number or datetime. For example,
GetStudyVal(studyname, ByBarNum, -3)
will return the study info string at the third bar before the last bar. (The info string is the same as that displayed on the chart tip window when left clicked.)
GetStudyVal(studyname, ByDateTime, "2025/03/14 09:30:00")
will get the info string at 9:30 bar.
GetStudyVal(studyname)
will simply return a single value at the latest bar.
If your studies are ordered in this way, the info string box will show them in the same order

Reading the current/last value of a study
Use cases
- Conditional entries - allow entry only if a moving average is above VWAP
- Custom indicators or semaphores - This has been described in the previous post https://www.guardiantrading.com/das-trader-pro-a-simple-green-light-for-entries/
Example
// check if price is below or above vwap
if($montage.LAST<getstudyval("studyVWAP"))
{
// display message
msgbox("No longs if price is below VWAP");
// end the script (optional)
return;
}
else
// otherwise run the standard entry code
{
$MONTAGE=GetWindowObj("MONTAGE1");
$MONTAGE.CXL ALLSYMB;
$buyprice=$MONTAGE.Ask;
$risk=GetAccountObj($MONTAGE.ACCOUNT).openEQ/800;
$mystop=$MONTAGE.price;
setvar("STOP_"+SYMB,$MYSTOP);
$pricetostop=$buyprice-$mystop;
$target=3*$pricetostop+Ask;
$amount=$risk/$pricetostop;
$MONTAGE.Share=$amount;
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.Price=Round($buyprice,2);
$MONTAGE.TIF=DAY+;
$MONTAGE.BUY;
$MONTAGE.TriggerOrder=RT:STOP STOPTYPE:RANGEMKT LowPrice:$mystop HighPrice:$target ACT:SELL QTY:POS TIF:DAY+;
}Reading the studies by time from the past
Use cases
- Backtesting - looking at the situation in the past bar by bar
- Calculating custom indicators and studies - e.g. what is the average volume of the last 10 candles?
Example
This code will show you the VWAP value of the exact time and date
msgbox(GetStudyVal("StudyVWAP", ByDateTime, "2026/05/29 09:31:00"));
Note that the time can be defined in multiple formats. Valid formats are
- HH/MM/SS
- HH:MM:SS
- YYYY/MM/DD HH:MM:SS
- YYYY/MM/DD HH/MM/SS
- EPOCH TIME (e.g. 1780047060)
The epoch time is the one that is allowing us to jump the candles bar by bar, as we can easily add or substract the chart time from the epoch time - e.g. 60 for the next 1-min candle.
If the time format is wrong, the last value of the study is read.
Showing is not reading
Unfortunately, the historical values are read and shown as strings. Meaning that from the above example, the value you get is not the VWAP value, but it is the "VWAP: 125.315" as a whole string.
To get the value in a number format, we need to use some extraction techniques.
For this purpose I have written a simple function to extract the value of VWAP
// read the VWAP value
$VWAPEXTRACT=GetStudyVal("StudyVWAP", ByDateTime, "2026/05/29 09:31:00");
//determine length
$LENGTH=strlen($VWAPEXTRACT);
//exit if 0
if($LENGTH==0)
{return;}
$MATMP=SubString($VWAPEXTRACT,6,$LENGTH-1);
$EXTR_VWAP=ROUND($MATMP,3);First I read the length of the string because VWAP: 125.315 is longer than VWAP:3.785.
Then I use a temporary variable MATMP which trims the text from position 6 until the end of the string, depending on its length. The -1 at the end is there because the string length is calculated from 1, while the position of the characters is calculated from 0, so a length of 10 ends at position 9.
The number 6 means that we are reading from position 6 - after the 5 characters of VWAP:.
While being trimmed, the value in MATMP is still a string/text so to convert it, it is passed to the ROUND() function, which converts it to a number, as explained in the previous post https://www.guardiantrading.com/das-trader-pro-rounding/
The resulting value in the EXTR_VWAP is a clean number 125.315, which can then be further used for calculations and comparisons.
For more advanced scripting, you can visit my Substack - Peter's Substack where I elaborate on the newest features, ideas and do custom solutions for specific needs.
Author: PeterB
Disclosure Statement 1. Hotkey scripts should always be thoroughly tested in a paper trading environment prior to any live deployment. Guardian Trading assumes no responsibility for errors, malfunctions, or financial losses arising from the use, misuse, or modification of custom hotkey configurations. Traders are solely responsible for the creation, testing, and implementation of their own scripts.This guide is provided for informational and educational purposes only and does not constitute trading advice or an endorsement of any specific configuration. The examples herein are illustrative in nature and should not be copied, replicated, or relied upon without independent verification and testing. Use of this material constitutes acknowledgment and acceptance of these terms.
2. No information provided by Velocity Clearing, LLC (“Velocity” or the “Firm”), directly or indirectly, should be considered a recommendation or solicitation to adopt any particular trading or investment strategy or to invest in, or liquidate, a particular security or type of security. Information provided by Velocity on its Twitter, Facebook or Blog pages is for informational and educational purposes only and is not intended as a recommendation of any particular security, transaction or strategy. Commentary and opinions expressed are those of the author/speaker and not necessarily those of the Firm. Velocity does not guarantee the accuracy of, or endorse, the statements of any third party, including guest speakers or authors of commentary or news articles. All information regarding the likelihood of potential future investment outcomes are hypothetical. Future results are never guaranteed. Any examples that discuss potential trading profits or losses may not take into account trading commissions or fees, which means that potential profits could be lower and potential losses could be greater than illustrated in any example. Users are solely responsible for making their own, independent decisions about whether to use any of the research, tools or information provided, and for determining their own trading and investment strategies.

