In the Variables region
private IOrder myEntryOrder = null;
OnBarUpdate():
// Entry Long Condition
if (myEntryOrder == null)
{
myEntryOrder = EnterLongLimit(1, true, DefaultQuantity, MaxRange, "LongLimit");
}
// Cancel LimitOrders condition
if (BarsSinceEntry() >= 3)
CancelOrder(myEntryOrder);
// Exit Condition Long
if (conditions
&& Position.MarketPosition == MarketPosition.Long)
{
ExitLong("Take Profit Long", "LongStopLimit");
myEntryOrder = null;
}
// Stop Loss Long
if (conditions
&& Position.MarketPosition == MarketPosition.Long)
{
ExitLong("LongStopLoss", "LongStopLimit");
myEntryOrder = null;
}
Thank you
Comment