Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with bar closure

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

    Problem with bar closure

    Hi. I'm a rookie programmer.
    I have this code
    (Volume[0] < Volume[1])&&(Volume[1] > Volume[2])
    The bar that fulfills this condition will be called the Bv
    I don't know how to do this now.
    If the Low[0] is < Bv then draw arrow
    thank you.

    #2
    Hello julifro,

    Thanks for your post.

    It depends on what of the Bv bar you are wishing to compare. I'll show a couple of ways.

    You could make Bv an int variable that holds the bar number of the latest bar that meets the criteria. You can then subtract the Bv from the CurrentBar to get the bars ago that the Bv was and reference that bars data, for example:

    if (Volume[0] < Volume[1])&&(Volume[1] > Volume[2])
    {
    Bv = Currentbar; // save bar number of the Bv bar
    }

    if (Low[0] < Low[CurrentBar - Bv]) // if the low is less than the low of the Bv bar.
    {
    // draw the arrow
    }

    Alternatively, if all you are interested in is the low Bv value then you could make the Bv a double variable and just store the low of the Bv bar at that point, for example:

    if (Volume[0] < Volume[1])&&(Volume[1] > Volume[2])
    {
    Bv = Low[0]; // save the Bv bar low value
    }

    if (Low[0] <Bv) // if the low is less than the low of the Bv bar.
    {
    // draw the arrow
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    27 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    17 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    9 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    10 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    17 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X