Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to say that something had happened on a High/Low of a bar?

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

    How to say that something had happened on a High/Low of a bar?

    Hello,

    how can I create a condition where I would like to find if something had happened on a Low or High of a bar? Would it differ when calculating OnBarClose and OnEachTick?

    Thank you

    #2
    Hello emuns,

    Thank you for your post.

    Current High and Low values for the currently forming bar can be accessed with High[0] and Low[0]. If you're calculating OnEachTick, these values will be updated in real time as new highs or lows are reached by the bar. Calculating OnBarClose means that these will return the final high and low for the bar and won't update intrabar.

    I'm not sure what you mean when you mean when you say find if something happened on the high or low of a bar. Could you be more specific about what you're trying to do?

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Hello Kate,

      sorry. I´m trying to create Unfinished auction indicator. Start seems to be clear:

      long askVolume = barsType.Volumes[CurrentBar].GetAskVolumeForPrice(Close[0]);
      long bidVolume = barsType.Volumes[CurrentBar].GetBidVolumeForPrice(Close[0]);

      if(askVolume > 0 && bidVolume > 0)

      ...but how to say that I mean ask and bid volume on a high or low of a bar?

      Thanks in advance,
      emuns

      Comment


        #4
        Hello emuns,

        Thank you for your reply.

        If you mean you want the volumes for the high price and the low price, you'd want to probably do this on bar close, but I'm not sure how you're wanting to use this exactly.

        GetAskVolumeForPrice and GetBidVolumeForPrice will get the volumes for a specific price. So, to get the ask volume at the high, you'd use

        long askVolume = barsType.Volumes[CurrentBar].GetAskVolumeForPrice(High[0]);

        If you wanted the volume for the low, you'd replace High[0] with Low[0].

        If you run this on each tick, you'll see the value of askVolume change as the volumes and high price changes. If you run it at the end of the bar, it'll give you the end result.

        Please let us know if we may be of further assistance to you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        81 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        41 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        66 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X