I the same Tradestation chart I have 1 minute (Data1) and 120 minute (Data2). I have put the strategy in Data1. One of my conditions is to buy when MACD of Data2 is below 0 and is rising. But when I test the strategy it neglects that condition (Condition1 in the code) and takes entries even when MACD is above 0. Greatful for input how to solve this. The strategy is verified.
Inputs: Price(Close of Data2),
ExpAv1 = XAverage(Price, Length1) of Data2;
ExpAv2 = XAverage(Price, Length2) of Data2;
MACD = ExpAv1 - ExpAv2;
Condition1 = MACD < 0 AND MACD > MACD;
Condition2 = High of Data2 > High of Data2;
Condition3 = High of Data1 > High of Data1;
If Condition1 AND Condition2 AND Condition3 Then Buy This Bar;
I don't think you can do this unless you insert a chart into another chart and the only way you can do that is if the charts are the same interval.
This is one of my chief complaints about TS's limitations for multi-time frame trading.
The current options are to use either Global Variables, Global Dictionary, or ADE.
I have a general sender/receiver for the global dictionary, but again, that has limitations as well, it won't backtest and depending on your applications, there are time stamp issues as TS only stamps data down to the 1 minute level.
If you want backtesting capability, then you'll have to go with ADE which makes the exercise beyond most moderate programming capabilities (you'd need a 3rd party code consultant).
If you can figure this out, I'd be very interested, but I've spoken with TS developers actually on the phone and they were supposed to be working on a temporary refinement of the GD sender and receiver to make it simpler to use.
I'm willing to bet that you're getting null values on your data2.
"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Given that your Data1 is 1min and your Data2 is 120min and you want TS to take into account BOTH, you probably need to setup a time condition that would perform Condition1, Condition2, Condition3 calculations only at pre-determined times when BOTH, Data1 and Data2, are available.