Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Change volume bar color based on price and volume range

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

    Change volume bar color based on price and volume range

    Hi,

    I wanted to code an indicator which changes the color of the volume bars based on criteria derived from the range / volume of each bar.

    e.g.

    Value2 = Volume *Range;
    If Value2 = Highest(Value2,20) then BarColor = ClimaxColor;

    BTW - This is taken from http://emini-watch.com/free-stuff/volume-indicator/

    However when I try to program this in NT I can't get the Highest value of Volume * Range to compare to the current value as a result of a problem parsing the Value3 to the MAX() function.

    EG:

    double Value3 = Volume[0] * Range()[0];


    if (CurrentBar < 1) // First bar?
    { // Yes.
    Values[0].Set(Volume[0]); // Plot it as an "equal" volume.
    return; // Done.
    }
    if (Value3[0] == MAX(Value3,20)[0])
    Values[
    2].Set(Volume[0]); // Yes. Plot it as an "Churn" volume.
    else
    Values[
    0].Set(Volume[0]); // Yes. Plot it as an "equal" volume.
    }
    }

    Can anyone help?

    Thanks.

    TiP2012

    #2
    I suggest debugging your indicator as per here: http://www.ninjatrader-support.com/v...ead.php?t=3418

    Comment


      #3
      OK - Found the problem and I am almost there...

      One question though, how can I create an If() statement which contains two conditions, e.g.:

      if ((V2MAX == Value2[0]) && (V3MAX == Value3[0]))
      Values[
      4].Set(Volume[0]);

      Using "&&" doesn't seem to work.

      Sorry for the really basic question, my programming experience is somewhat limited as you can tell although growing every day.

      Thanks.

      Comment


        #4
        Cancel that, I see it was a problem with the plot order.

        Comment


          #5
          Hello,

          I think someone is working on this already. Its called "Better Volume Beta"
          See this link:

          Comment


            #6
            Thanks Dwalls, I found the other persons code and it is indeed the same thing.

            TiP2012

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by funk10101, Today, 09:43 PM
            0 responses
            2 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            36 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            44 views
            0 likes
            Last Post bill2023  
            Started by yertle, Today, 08:38 AM
            6 responses
            25 views
            0 likes
            Last Post ryjoga
            by ryjoga
             
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            24 views
            0 likes
            Last Post algospoke  
            Working...
            X