I use daily candles and would like to avoid huge opening gaps.
The strategy should only buy, if the current day opening is within a certain range +-X% of last days close.
Since the the strategy only has one candle per day I 'am not sure if my approach would work:
&& (Close[0]) * (1 + GapUpLong) >= CurrentDayOHL().CurrentOpen[0]
&& (Close[0]) * (1 - GapDownLong) <= CurrentDayOHL().CurrentOpen[0])
Also is there anything I need to change in the general settings?
protected override void Initialize()
{
EntriesPerDirection = 2;
EntryHandling = EntryHandling.AllEntries;
SetStopLoss("", CalculationMode.Percent, StopProzent, true);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
EntriesPerDirection = 2;
EntryHandling = EntryHandling.AllEntries;
(..........Random Strategy................)
[COLOR="Red"][SIZE="3"] && (Close[0]) * (1 + GapUpLong) >= CurrentDayOHL().CurrentOpen[0]
&& (Close[0]) * (1 - GapDownLong) <= CurrentDayOHL().CurrentOpen[0])[/SIZE][/COLOR]
{
EnterLong(DefaultQuantity, "");
}
I also tried:
EnterLongStopLimit(DefaultQuantity, (Close[0]) * (1 + GapUpLong), (Close[0]) * (1 - GapDownLong), "");
But backtesting gave me 0 trades on this one.
So what is the most practical way to avoid opening gaps?

Comment