if (Position.MarketPosition == MarketPosition.Flat)
if (entryOrder == null && Position.MarketPosition == MarketPosition.Flat
&& Volume[0] > Volume[1])
{
entryOrder = EnterLongStop(Convert.ToInt32(DefaultQuantity),Hig h[0] + TickSize*2,"LongEntry"+ CurrentBar);
}
if (entryOrder == null && Position.MarketPosition == MarketPosition.Flat
&& Volume[0] > Volume[1])
{
entryOrder = EnterShortStop(Convert.ToInt32(DefaultQuantity),Lo w[0] - TickSize*2,"ShortEntry"+ CurrentBar);
}
So far so good. Long and short positions are opened.
But if I put this code:
if (entryOrder != null && Position.MarketPosition == MarketPosition.Long)
{
SetStopLoss("LongEntry" + CurrentBar, CalculationMode.Price,(Low[0]- 2*TickSize), false);
}
the short entries are no longer produced. I don't understand logic. Could you explain? thank you.
I want to do this:
the condition is given long entry, stop and long objective.
If they are not reached and the condition is given to turn to short.
I don't get it.
Comment