|
charlotte, nc
Posts: 1 since Sep 2011
Thanks Given: 0
Thanks Received: 0
|
can anyone recommend how to prevent a strategy that is supposed to be reversing, from exiting as it should, then entering the same position immediately, then closing this position, and then finally reversing as it should have?
Current code is below:
if strend=1 then buy("in") next bar at open;
If marketposition=1 and cebschaff<longout and cebschaff[1]>longout then sell("out") this bar on close;
If strend<>1 then sellshort("in.") next bar at open;
If marketposition=-1 and cebschaff>shortout and cebschaff[1]<shortout then buytocover("out.") this bar on close;
//pyramiding
If marketposition=1 then begin;
buy ("2nd") next bar at entryprice+(10*tick) stop;
buy ("3rd") next bar at entryprice+(20*tick) stop;
buy ("4th") next bar at entryprice+(30*tick) stop;
buy ("5th") next bar at entryprice+(40*tick) stop;
end;
If marketposition=-1 then begin;
sellshort ("2") next bar at entryprice-(10*tick) stop;
sellshort ("3") next bar at entryprice-(20*tick) stop;
sellshort ("4") next bar at entryprice-(30*tick) stop;
sellshort ("5") next bar at entryprice-(40*tick) stop;
end;
|