Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Gaps indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Gaps indicator

    Hi,

    recently I created very simple indicator which prints 1 if the todays open is
    equal or above/below prior high/low. I am using it for e-mini gaps. This is the code:

    {
    if (CurrentDayOHL().CurrentOpen[0] >= PriorDayOHLC().PriorHigh[0] || CurrentDayOHL().
    CurrentOpen[0] <= PriorDayOHLC().PriorLow[0])
    Value.Set(1);

    else Value.Set(0);
    }

    I want to ask is it possible to make any modification in a way that it prints 1 even when
    for example e-mini open is 1 point below previous high.
    My point is that I want a gap print even if todays open is maximum 1 point below
    previous day high.

    Thanks

    #2
    Hello flexi,

    Thanks for the post and welcome to the forums!

    I added the statements to your code segment that will meet your needs.

    Basically the parts I added, in Blue, are asking is the PriorDay High - the CurrentDay Open > 0 && < = 4 ticks. Note that I also added () in Red to enclose the whole statement.

    Code:
    if [COLOR="red"]([/COLOR](CurrentDayOHL().CurrentOpen[0] >= PriorDayOHLC().PriorHigh[0]
    || CurrentDayOHL(). CurrentOpen[0] <= PriorDayOHLC().PriorLow[0])
    [COLOR="Blue"]|| (((PriorDayOHLC().PriorHigh[0] - CurrentDayOHL().CurrentOpen[0]) / TickSize) > 0 
    && ((PriorDayOHLC().PriorHigh[0] - CurrentDayOHL().CurrentOpen[0]) / TickSize) <= 4)[/COLOR][COLOR="Red"])[/COLOR]
    {
    Value.Set(1);
    }
    else 
    {
    Value.Set(0);
    }
    TickSize contains the tick value of the instrument and is used to convert price to ticks. This way you can apply this code to any instrument. Of course the value of 1 point is different depending on the instrument and in this case I assumed ES where 4 ticks = 1 point. In your code you could add a user settable value for the number of ticks to evaluate for.

    Please let me know if I can be of further assistance.

    Comment


      #3
      That worked great.

      Thank you very much

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      576 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X