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

Update indicator plot in strategy

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

    Update indicator plot in strategy

    Hi,

    I'm developing a strategy that uses Add(Indicator(StartingPeriod)) inside Initialize() to show plot using a user defined Parameter for StartingPeriod.

    Inside the strategy when Indicator(StartingPeriod) is called, StartingPeriod is a dynamic variable, and changes OnBarUpdate().

    How can I update the plot of Indicator(StartingPeriod) in the OnBarUpdate().

    Thanks!

    #2
    ngsevers, welcome to our forums - this is something undocumented so we could not officially support it, however have you tried Indicator(StartingPeriod).YourUserInput = your new period value?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Thanks for the reply; i've already tried that.. the graph still shows the output with the original StartingPeriod unchanged.. do you have any other ideas?

      Thanks in advance!
      Noah

      Comment


        #4
        Another idea would be coding the dynamic adjustment directly into the study you Add() in visuals, this way all is taken care of internally already.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          The only way I could see to do it would be to move the dynamic period calculations into the indicator itself. But this seems kind of backwards..

          Is there not a way to access the parameter of the indicator that was added using the Add() method and modify it and force an update of the graph.. something like Indicator(StartingPeriod).Update() ?

          Comment


            #6
            Unfortunately there would be nothing supported I can offer here. In my testing setting the period for example of the added script worked out as I would expect, that's the only idea I would have to workaround.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Are you testing on live data or backtesting.. I was backtesting when testing Indicator(StartingPeriod).YourUserInput = your new period value..

              I haven't checked to see if it functions differently on live data or if it makes a difference..

              Comment


                #8
                I was backtesting directly applied to a chart.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by TheTradingMantis, 01-19-2023, 02:05 AM
                42 responses
                911 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by _Zero_, 04-10-2020, 03:21 PM
                144 responses
                7,893 views
                6 likes
                Last Post NinjaTrader_ChelseaB  
                Started by Richozzy38, Yesterday, 01:06 PM
                7 responses
                28 views
                0 likes
                Last Post Richozzy38  
                Started by swjake, Today, 12:04 PM
                5 responses
                16 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by forrestang, Today, 01:41 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Erick  
                Working...
                X