Multi time frame question for backtesting

Questions about MultiCharts and user contributed studies.
Duvald
Posts: 18
Joined: 11 Dec 2008

Multi time frame question for backtesting

Postby Duvald » 11 Dec 2008

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

User avatar
TJ
Posts: 6572
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 968 times
Been thanked: 1901 times

Postby TJ » 11 Dec 2008

value1 = close of data2

SUPER
Posts: 624
Joined: 03 Mar 2007
Has thanked: 99 times
Been thanked: 80 times

Postby SUPER » 11 Dec 2008

There are some question marks about use of "Crosses" in your strategy have a look at following thread for more explanation.

http://forum.tssupport.com/viewtopic.ph ... ght=#21351

Duvald
Posts: 18
Joined: 11 Dec 2008

Postby Duvald » 12 Dec 2008

value1 = close of data2


I don't see how this reference ATR of previous bar from entry bar, on data2 ?!

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Re: Multi time frame question for backtesting

Postby Marina Pashkova » 18 Dec 2008

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


Hi Duvald,

Try the code below:

Code: Select all

input:
   length(10);
var:
   val(0, data2);
val = AvgTrueRange( length ) of data2;
setstoploss(val[1]);


Let me know how it works for you.


Return to “MultiCharts”