Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 9/14/2009(UTC) Posts: 1
|
Hi,
I would like to make a formula to use for backtesting that makes this:
1) Buy when weekly 13 EMA is going up, and daily candle closes above daily 13 EMA;
2) Sell when daily candle closes bellow daily 13 EMA;
3) Sell short when weekly 13 EMA is going down, and daily candle closes bellow daily 13 EMA;
4) Buy to close when daily candle closes above daily 13 EMA;
Can anyone help please?
regards, BBCTrader
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi BBCTrader
If you have the "Multi-Frame D EMA" indicator installed and set with the appropriate options (13 weeks etc.) then the following code should provide you with a starting point. Each block of signals is truncated and only the first TRUE is allowed to pass. You can get this indicator at...
http://www.metastocktips.co.nz/multi_frame_d_ema.txt
{Buy}
K:=Fml("Multi-Frame D EMA");
J:=FmlVar("Multi-Frame D EMA","J");
Buy:=K>ValueWhen(2,J,K) AND C>Mov(C,13,E);
Buy AND Alert(Buy=0,2);
{Sell}
Sell:=C<Mov(C,13,E);
Sell AND Alert(Sell=0,2);
{Sell Short}
K:=Fml("Multi-Frame D EMA");
J:=FmlVar("Multi-Frame D EMA","J");
Short:=K<ValueWhen(2,J,K) AND C<Mov(C,13,E);
Short AND Alert(Short=0,2);
{Buy to Cover}
Cover:=C>Mov(C,13,E);
Cover AND Alert(Cover=0,2);
Regards, Roy
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.