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 TraderBCL, Today, 04:38 AM
                2 responses
                13 views
                0 likes
                Last Post TraderBCL  
                Started by martin70, 03-24-2023, 04:58 AM
                14 responses
                105 views
                0 likes
                Last Post martin70  
                Started by Radano, 06-10-2021, 01:40 AM
                19 responses
                607 views
                0 likes
                Last Post Radano
                by Radano
                 
                Started by KenneGaray, Today, 03:48 AM
                0 responses
                4 views
                0 likes
                Last Post KenneGaray  
                Started by thanajo, 05-04-2021, 02:11 AM
                4 responses
                471 views
                0 likes
                Last Post tradingnasdaqprueba  
                Working...
                X