Hi,
i'm making a backtest system with a multi 2 charts of the same symbol: on small timeframe (data1) and one longer timeframe (data2).
I enter position when data1 crosses previous high of data2. So trade is occurring on data1.
Stop loss is placed at entry price - atr value calculated on previous bar of Data2.
How can I use easylangage to calculate ATR of the bar previous from entry bar on Data2, since trade occured on data1 ?
Thanks
Multi time frame question for backtesting
- TJ
- Posts: 7752
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2228 times
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Re: Multi time frame question for backtesting
Hi Duvald,Hi,
i'm making a backtest system with a multi 2 charts of the same symbol: on small timeframe (data1) and one longer timeframe (data2).
I enter position when data1 crosses previous high of data2. So trade is occurring on data1.
Stop loss is placed at entry price - atr value calculated on previous bar of Data2.
How can I use easylangage to calculate ATR of the bar previous from entry bar on Data2, since trade occured on data1 ?
Thanks
Try the code below:
Code: Select all
input:
length(10);
var:
val(0, data2);
val = AvgTrueRange( length ) of data2;
setstoploss(val[1]);