Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get price level from last 4 bars

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

    Get price level from last 4 bars

    How can i get halfHighLow in price level? if i currently print halfHighLow it returns number of points but i want a price level.

    Code:
    double congestionHighestValue = MAX(High, 4)[0];
                double congestionLowestValue = MIN(Low, 4)[0];​
    double halfHighLow = (congestionHighestValue - congestionLowestValue);

    #2
    Hello tkaboris,

    Thank you for your post.

    Based on your snippet, you are currently calculating the difference between the highest high and lowest low in the last four bars. This is not a price level - you mention "halfHighLow" so I suspect you are looking for the price in between the highest high and lowest low from the last four bars. To calculate this, you will need to divide your current value for halfHighLow by 2 and then either add it to the lowest low or subtract it from the highest high.

    You may verify this information with Print() statements. For example, if you print congestionhighestValue and the output is 1256 and then you print congestionLowestValue and the output is 1237, then it makes sense that halfHighLow would equal 1256 - 1237 so the output would be a "point value" of 19. If you wanted to get the price in between 1256 and 1237, you need to take 19 divided by 2 which is 9.5 then you could add that to 1237 or subtract it from 1256 and get 1246.5.

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    651 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    577 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X