Here is the code:
int LongTradeCount =0;
int ShortTradeCount =0;
if(Close[0]>Open[0])
{ShortTradeCount =0;}
else if(Close[0]<Open[0])
{LongTradeCount =0;}
else if(
SMA(Close,5)<Close[0]
&&LongTradeCount==0
)
{
EnterLongLimit(DefaultQuantity, Close[0], "L");
++LongTradeCount;
}
else if(
SMA(Close,5)>Close[0]
&&ShortTradeCount==0
)
{
EnterShortLimit(DefaultQuantity, Close[0], "S");
++ShortTradeCount;
}

Comment