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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        151 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X