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 sidlercom80, 10-28-2023, 08:49 AM
                167 responses
                2,260 views
                0 likes
                Last Post jeronymite  
                Started by warreng86, 11-10-2020, 02:04 PM
                7 responses
                1,362 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by Perr0Grande, Today, 08:16 PM
                0 responses
                5 views
                0 likes
                Last Post Perr0Grande  
                Started by elderan, Today, 08:03 PM
                0 responses
                9 views
                0 likes
                Last Post elderan
                by elderan
                 
                Started by algospoke, Today, 06:40 PM
                0 responses
                10 views
                0 likes
                Last Post algospoke  
                Working...
                X