On a strategy that uses two time frames, data1 is 5 minute and data2 is 60 minute. Trade entry rules are based on indicator on data1, let's say rsi and two moving averages on data2. Entry price is based on the high of the stick in data2 when all the conditions are met. To check the conditions do I write:
Code: Select all
If Barstatus(1) = 2 and Marketposition <= 0 then VariableRSI = RSI(length)data1;
If Barstatus(2) = 2 and MP <= 0 then begin
ShortMA = Average(c, shortlength) data2;
LongMA = Average(c,longlength) data2;
end;
Do the variables VariableRSI, ShortMA and LongMA need to be declared as intrabarpersist?
For the entry order, would it need to be written like this?
Code: Select all
If Barstatus(1) = 2 and MP <=0 and VariableRSI > Threshold and ShortMA > LongMA and (some price logic for bar price) then begin;
Buy next bar at market;
end;
Confused about intrabarpersist variables. Not sure if when Intrabar Order Generation is turned on whether or not these variable will keep there value from bar to bar without it.