Hi guys, i have this Expert code i'd like to improve with the following:
1) when long ( condition mov(h,3,e)>mov(h,30,e) ), if C is less than the max close in the past N bars (periods)) then exit long.
2) when short ( condition mov(l,3,e)<mov(l,30,e) ),if C is greater than the min close in the past N bars (periods)) then exit short.
I cannot have the whole condition... How should i modify this if((1+VAR1)*mov(h,3,e)>mov(h,30,e),LE>SE,0) to get 1)? Please could someone help?
ENTRY LONG
B:=MOV(Ref(1.02*LLV(L,42),0),3,e);
A1:=MOV(Ref(0.98*HHV(H,42),0),3,e);
mi:=(A1+B)/2;
LE:=C>=Mi;
SE:=C<mi;
VAR1:=0.15*STDEV(C,10);
if((1+VAR1)*mov(h,3,e)>mov(h,30,e),LE>SE,0)
ENTRY SHORT
B:=MOV(Ref(1.02*LLV(L,42),0),3,e);
A1:=MOV(Ref(0.98*HHV(H,42),0),3,e);
mi:=(A1+B)/2;
LE:=C>=Mi;
SE:=C<mi;
VAR1:=0.15*STDEV(C,10);
if((1+VAR1)*mov(L,3,e)<mov(L,30,e),LE<SE,0)
P.S. This script seem to work well. I backtested it on italian eod data on different time periods. think it's fine.
If anyone would like to it and post here what he thinks is welcome. Any improvement, new ideas, are welcome...