I use the following code for entry and exit. However, it takes the long trade only and not the short trade.
if (Position.MarketPosition==MarketPosition.Flat)
{
if (CrossAbove(EMA(Fast), EMA(Slow), 1))
{
EnterLong(1);
SetStopLoss(CalculationMode.Ticks,SL);
}
if (CrossBelow(EMA(Fast), EMA(Slow), 1))
{
EnterShort(1);
SetStopLoss(CalculationMode.Ticks,SL);
}
}
else if (Position.MarketPosition==MarketPosition.Long)
{
if (Close[0]<EMA(Slow)[0])
ExitLong(1);
}
else
{
if (Close[0]>EMA(Slow)[0])
ExitShort(1);
}
I would like to enter the short trade when the condition is met.
Please advise.
Rajesh
Comment