cant fing wath wrong
work only if remove if (myEntryOrder == null)
private IOrder myEntryOrder = null;
private int barNumberOfOrder = 0;
protected override void Initialize()
{
CalculateOnBarClose = true;
ExitOnClose=false;
EntriesPerDirection=1;
Slippage = 2;
EntryHandling = EntryHandling.UniqueEntries;
ConnectionLossHandling = ConnectionLossHandling.KeepRunning;
SetProfitTarget("Buy", CalculationMode.Ticks, Profit);
SetStopLoss("Buy", CalculationMode.Ticks, Stop, false);
}
protected override void OnBarUpdate()
{
if(Close[0] > Close[1])
if (myEntryOrder == null)
if (BarsInProgress == 0)
{
myEntryOrder = EnterLongLimit(0, true, 1, Low[1], "Long Entry");
barNumberOfOrder = CurrentBar;
}
else if (CurrentBar > barNumberOfOrder + 5)
CancelOrder(myEntryOrder);
}
Comment