Hello OXUS,
Thank you so much for your such a prompt reply. I have slightly updated the formula. The revised formula is:
{NEUTRAL}
fml1:=If(O>(C*102/100),L,
If(O<(C*98/100),H,(O+C)/2));
Mov(Ref(fml1,-1),3,S);
{Volatile}
a:=C+L-O;
b:=C+H-O;
d:=2*O-H;
f:=2*O-L;
fml1:=If(O>=C,(a*d/f)*O/C,(b*f/d)*O/C);
Mov(Ref(fml1,-1),3,S);
{buy signal}cross(neutral,volatile)
{sell signal}cross(volatile,neutral)
{above formula only shows the trend and I dont know how to optimize it to pick most profitable troughs and peaks}
=============================
dear oxus, I have data upto 13/07/2007. I could not visualize as the bar of 13/07/2007 refers to the data of previous bar so what signal it gives. I mean the signal for 13/07/2007 or 14/07/2007. Where is the signal for actusal 13/07/2007 as the chart is not extending to next bar. If the bar of 13/07/2007 gives the signal for next bar by taking the data of the previous bar, why it is necesaary to take the data of the previous bar? This may seem very innocent but it is boggling me.
You please give a simple example of writing "expert advisor". When I tried to plot the signals I am getting the signal for the same bar and not the next bar.
Thanks a lot,
Basudeo
The bar delay in metastock is used only for testing systems, not for scanning stocks. If you are to write the formula in expert advisor, try using the original code, without the bar delay. Since I use
Tradesim for backtest, and since I haven't used metastock's backtester since last november, my knowledge with backtester is a bit shaky.
Regarding the expert advisor, here's an example of a moving average crossover (just an example...)
Tools ---> Expert adviser ---> new ---> Give it a name ---> Symbols ---> new
1) Name = Long Enter.
Formula:
a:= Mov(C,5,S); {Fast MA}
b:= Mov(C,8,S); {Slow MA}
Cross(a,b); {Condition}
2) Short Enter:
Formula:
a:= Mov(C,5,S); {Fast MA}
b:= Mov(C,8,S); {Slow MA}
Cross(b,a); {Condition}
x----------------------------------------x
Go to highlights ---> New
1) Name = Long Phase
Colour = Green
Formula:
a:= Mov(C,5,S); {Fast MA}
b:= Mov(C,8,S); {Slow MA}
BarsSince(a) < BarsSince(b); {Condition}
2) Name = Short Phase
Colour = Red
Formula:
a:= Mov(C,5,S); {Fast MA}
b:= Mov(C,8,S); {Slow MA}
BarsSince(a) > BarsSince(b); {Condition}
x--------------------------------------------------x
Writing commentary is a tricky part and pretty difficult as compared with coding. However, it isn't as important.
Sincerely yours.