Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BuySellVolume Indicator

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

    BuySellVolume Indicator

    Hi,

    I'm trying to add the buy sell volume if the Close of the current bar is the same as the previous bar. It's not adding the buy or the sell volume. Is there something that I'm doing wrong?

    Code:
    if (Close[0] == Close[1])
    
    {
    
    buyvolume += BuySellVolume1.Buys[0];
    
    sellvolume += BuySellVolume1.Sells[0];
    
    }
    
    else if (Close[0] != Close[1])
    
    {
    
    buyvolume = 0;
    
    sellvolume = 0;
    
    }
    ​

    #2
    Hello AgriTrdr,

    This may be due to your condition, checking if one double price is equal to another is most always false. You can read about a way to compare equality on floating point numbers here:



    You can check if thats happening by printing the two prices being compared and also inside of each condition to see when each part of the if else statement is happening.

    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