Iâm carrying out testing in TradeStation using 5-minute data and need to refer to daily data for a daily True Range calculation.
Normally this would not be a problem as I place 5-minute data in Data1 and daily data as Data2. However in my coding I need to use the âdate of next barâ command and when I do, TS cannot refer to any data other than Data1.
For example, with an entry using a simple Opening Range Breakoutâ¦
I get an error message saying âcannot mix next bar prices with data streams other than data1â.
Since I need to use "date of next bar" to define the correct opening price, is there anyway that I can calculate the daily ATR within the system coding as well as being able to use the âdate of next barâ command?
Normally this would not be a problem as I place 5-minute data in Data1 and daily data as Data2. However in my coding I need to use the âdate of next barâ command and when I do, TS cannot refer to any data other than Data1.
For example, with an entry using a simple Opening Range Breakoutâ¦
Code:
{data1 is 5-minute data, data2 is daily data, ATR[20] = AverageTrueRange(20) of daily data}
vars: DATR(0);
DATR = AvgTrueRange(20) of data2;
If date < date of next bar then Buy at Open of next bar + 0.3*DATR stop;
{If it's the last 5-minute bar of today,
place a stop order at Open of Tomorrow + 0.3*ATR[20].
Cannot use OpenD(0) here,
because OpenD(0) uses the Open of Today rather than the Open of tomorrow}
If date = date of next bar and @entrydate(1) <> date then Buy at OpenD(0) + 0.3*DATR stop;
{If next 5-minute bar is still within the same day, place an stop order at Open of Today + 0.3*ATR[20]}
I get an error message saying âcannot mix next bar prices with data streams other than data1â.
Since I need to use "date of next bar" to define the correct opening price, is there anyway that I can calculate the daily ATR within the system coding as well as being able to use the âdate of next barâ command?