• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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
    DierkNinjaTrader Customer Service

    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:
          http://www.ninjatrader-support.com/v...ead.php?t=7457

          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 bultakkoz, Today, 02:28 AM
            0 responses
            4 views
            0 likes
            Last Post bultakkoz  
            Started by kunahoylea, Today, 01:07 AM
            0 responses
            1 view
            0 likes
            Last Post kunahoylea  
            Started by qewcool, Yesterday, 10:51 PM
            0 responses
            2 views
            0 likes
            Last Post qewcool
            by qewcool
             
            Started by momchi, Yesterday, 10:09 PM
            0 responses
            2 views
            0 likes
            Last Post momchi
            by momchi
             
            Started by crokusek, Yesterday, 09:56 PM
            0 responses
            5 views
            0 likes
            Last Post crokusek  
            Working...
            X