If DPlusDMin AND ADXVal Crosses Over DMin and MarketPosition 1 then begin
BuyPrice = High;
BuySetup = true;
ExitLPrc = Low;
End;
If ADXValDMin or MarketPosition = 1 then BuySetup = False;
If DPlus DMin AND ADXVal Crosses Over DPlus and MarketPosition -1 then begin
SellPrice = Low;
SellSetup = true;
ExitSPrc = High;
End;
If ADXVal DPlus or MarketPosition = -1 then SellSetup = False;
If BuySetup then Buy 1 Contracts next bar at BuyPrice stop;
If SellSetup then SellShort 1 Contracts next bar at SellPrice stop;
If MarketPosition = 1 then Begin
BuySetup = false;
sell next bar at ExitLPrc Stop;
End;
If MarketPosition = -1 then begin
SellSetup = True;
Buytocover next bar at ExitSPrc stop;
End;
{ADX Exit Strategy}
If (ADXVal[1]=ADXExit and ADXValADXVal[1]) then Begin
If MarketPosition=1 and BarssinceEntry1 then sell this bar at close;
If MarketPosition=-1 and BarsSinceEntry1 then buytocover this bar at close;
End;
If DPlusDMin and BarsSinceEntry1 then sell next bar at Lowest(Low,3) stop;
If DPlusDmin and BarsSinceEntry1 then buytocover next bar at Highest(High,3) stop;