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

VWAP - up/down color change

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

    VWAP - up/down color change

    I use the following indicator code on my tradestation 233 tick chart.
    [LegacyColorValue = true];
    { VWAP MA }
    input:
    Price(AvgPrice),length(25),upColor(cyan),dnColor(r ed);
    vars:
    it(0);
    it = VWAP_SMA(Price,length);
    plot1(it,"VWAP MA");
    if plot1 > plot1[1] then setplotcolor(1,upColor);
    if plot1 < plot1[1] then setplotcolor(1,dnColor);

    Can someone tell me how to code this in Ninja?

    #2
    toddaclark,

    For color changes please see this: http://www.ninjatrader-support2.com/...ead.php?t=3227
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      Thanks for your reply. I downloaded the indicator that you mentioned in your post.

      That indicator seems to use SMA. How can I change it to be VWMA instead of SMA?

      Also, how do I get the candles above VWAP to paint blue and the candles below VWAP to paint red?

      Comment


        #4
        toddaclark,

        The link I referred you to is a reference sample. You can make changes you want to it however you see fit. If you don't want to use SMA just replace it with whatever you do want to use.

        You will need to program yourself an indicator that checks the VWAP and then colors the candles. To color the candles you want to use BarColor.

        if (some condition)
        BarColor = Color.Red;
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          take a look at the MACDUpDown code to see how to color it


          Originally posted by toddaclark View Post
          I use the following indicator code on my tradestation 233 tick chart.
          [LegacyColorValue = true];
          { VWAP MA }
          input:
          Price(AvgPrice),length(25),upColor(cyan),dnColor(r ed);
          vars:
          it(0);
          it = VWAP_SMA(Price,length);
          plot1(it,"VWAP MA");
          if plot1 > plot1[1] then setplotcolor(1,upColor);
          if plot1 < plot1[1] then setplotcolor(1,dnColor);

          Can someone tell me how to code this in Ninja?

          Comment


            #6
            another idea would be to set some public boolean properties within VWAP (you'd have to recode VWAP to do this) ... and then you could load up a VWAP in your indicator and do what Josh said to color the candles accordingly by accessing those properties

            eg. in your new indicator:
            Code:
            if (myVWAP.IsSomething == true) { BarColor = Color.Red; }
            elseif (myVWAP.IsSomethingElse == true) { BarColor = Color.Green; }

            Comment


              #7
              Thanks for everyone's comments!

              Much appreciated!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by AttiM, 02-14-2024, 05:20 PM
              12 responses
              212 views
              0 likes
              Last Post DrakeiJosh  
              Started by cre8able, 02-11-2023, 05:43 PM
              3 responses
              237 views
              0 likes
              Last Post rhubear
              by rhubear
               
              Started by frslvr, 04-11-2024, 07:26 AM
              8 responses
              116 views
              1 like
              Last Post NinjaTrader_BrandonH  
              Started by stafe, 04-15-2024, 08:34 PM
              10 responses
              47 views
              0 likes
              Last Post stafe
              by stafe
               
              Started by rocketman7, Today, 09:41 AM
              3 responses
              11 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X