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 cre8able, Today, 01:01 PM
            0 responses
            2 views
            0 likes
            Last Post cre8able  
            Started by manitshah915, Today, 12:59 PM
            0 responses
            3 views
            0 likes
            Last Post manitshah915  
            Started by ursavent, Today, 12:54 PM
            0 responses
            3 views
            0 likes
            Last Post ursavent  
            Started by Mizzouman1, Today, 07:35 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by RubenCazorla, Today, 09:07 AM
            2 responses
            13 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X