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

Painting bars based on condition question

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

    Painting bars based on condition question

    Hello,

    What would the code be for the following condition?

    If the MACD Histogram value is above the 0 line, and the MACD is above the 0 line then color price bars green. And the same for the inverse - color bars red.

    If you need reference, please see the following video around time: 3:45. Thanks.

    Congratulations! Congratulations! To Master “The Wheel” …Just Watch The Videos and Read the Free Book! Video 1 I start with showing you the how The Wheel


    Would also like to know the code to get the Average Daily RANGE to print on the chart. See video at around 6:00 for the logic. Very simple.
    Last edited by ericadam; 09-05-2008, 12:09 AM.

    #2
    Bump.. anyone?

    Comment


      #3
      Code:
      if (MACD(12,26,9).Diff[0] > 0 && MACD(12,26,9)[0] > 0)
            BarColor = Color.Green;
      else if (MACD(12,26,9).Diff[0] < 0 && MACD(12,26,9)[0] < 0)
            BarColor = Color.Red;
      For Average Daily Range. You need to create a custom indicator. You would create a DataSeries and then store the calculation of CurrentDayOHL().CurrentHigh[0] - CurrentDayOHL.CurrentLow[0]. After you have this DataSeries, say we call it DailyRange, then we would go and run an SMA on it.

      Code:
      SMA(DailyRange, 7)[0];
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        HUGE, thank you so much

        Comment


          #5
          Is there anyway to print just the value of the avg daily range, 7 in the charts versus a plot

          Comment


            #6
            Sure. Just create the custom indicator and instead of doing something like Plot0.Set(SMA(DailyRange, 7)[0]);

            Just don't set a value to Plot0 and use DrawTextFixed() to write out the value of SMA(DailyRange, 7)[0].
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              How would I create the data series to store the calculation?

              Comment


                #8
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NRITV, Today, 01:15 PM
                2 responses
                9 views
                0 likes
                Last Post NRITV
                by NRITV
                 
                Started by frankthearm, Today, 09:08 AM
                8 responses
                31 views
                0 likes
                Last Post frankthearm  
                Started by maybeimnotrader, Yesterday, 05:46 PM
                5 responses
                26 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by quantismo, Yesterday, 05:13 PM
                2 responses
                20 views
                0 likes
                Last Post quantismo  
                Started by adeelshahzad, Today, 03:54 AM
                5 responses
                33 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Working...
                X