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

Changing Colors

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

    Changing Colors

    I seem to be Thick Headed on this topic. I want an indicator, say MACD, where the Diff, plotted as bars, changes colors.

    The idea is

    if this bar > bar[1] then make (this bar) green else make it red

    I've tried placing the Plots[2].Min=Diff[1] in the OnBarUpdate() method, thinking this would set the thresholds by comparing to the previous bar value.

    It compiles and plots, but it still changes all history bars based on the current evaluation. I don't want to change the history, just the Current bar.

    I know there is something simple I'm missing , just need some guidance I guess.

    #2
    imported post

    A plot in NinjaScript can only have one color at any given moment. They can not have dual colors.

    Therefore, to implement what you want, you have to have two plots, and only show the plot that you want based on the condition you specify.

    The attached sample indicator does exactly what you want. This indicator uses the DataSeries.Reset() method which is not working in NT6 Beta 5 right now.
    Ray
    Attached Files
    RayNinjaTrader Customer Service

    Comment


      #3
      imported post

      The sample indicator will generate the following output.


      Attached Files
      RayNinjaTrader Customer Service

      Comment


        #4
        imported post

        OK, thanks, I'll study this this tonight. Maybe my thick head can get softened up a bit.

        Comment


          #5
          Hi.
          I tried to import Mdiff but i got the following error.

          ''archive was not exported by ninjatrader or its contents have been manipulated.''

          any help?
          thanks

          Comment


            #6
            Hi subterfuge,

            Thank you for your post.

            Unfortunately, it seems that was exported using a much older version of NinjaTrader, and cannot be imported using the current version.

            However, here is a page from out Help Guide that demonstrates the same concept in a tutorial.
            TimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by GussJ, 03-04-2020, 03:11 PM
            12 responses
            3,239 views
            0 likes
            Last Post Leafcutter  
            Started by AveryFlynn, Today, 04:57 AM
            0 responses
            4 views
            0 likes
            Last Post AveryFlynn  
            Started by RubenCazorla, 08-30-2022, 06:36 AM
            3 responses
            79 views
            0 likes
            Last Post PaulMohn  
            Started by f.saeidi, Yesterday, 12:14 PM
            9 responses
            25 views
            0 likes
            Last Post f.saeidi  
            Started by Tim-c, Today, 03:54 AM
            0 responses
            3 views
            0 likes
            Last Post Tim-c
            by Tim-c
             
            Working...
            X