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

StrategyPlot starts plotting at zero in price panel

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

    StrategyPlot starts plotting at zero in price panel

    I have been using StrategyPlot for several indicators that plot in panels 2, 3 etc. and they work fine.

    I am now trying to overlay in the price panel and using

    if ( CurrentBar < 20 )
    return;

    which results in the indicator plotting at 0 on the 21st bar.

    In other panels this does not matter as they have a small scale and 0 center line. However in the price panel of course this compresses the price scale.

    I have tried everything I can think of to initialize the plot at the session start etc and nothing works. How do I start it at a realisitic value? Or even better stop it from plotting until the value > 0?

    I am using

    if ( !Historical && myPrice > 0 )
    myPlot(0).Value.Set( myPrice );

    and that makes no difference. It still plots on the 21st bar at 0.

    Thanks in advance.

    ATI

    #2
    How about only setting the plot value when it is greater than zero?
    RayNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ray View Post
      How about only setting the plot value when it is greater than zero?
      you lost me there...am I not doing that with:

      if ( !Historical && myPrice > 0 )
      myPlot(0).Value.Set( myPrice );

      Comment


        #4
        See if you can turn off AutoScale. You may need to edit the StrategyPlot() indicator to do so if you cannot do it within the strategy.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          sorry Ray...I do not understand your reply...please see my last reply

          Comment


            #6
            ATI User this is Josh .

            What I suggested will not do anything for the plot setting itself to zero. If it worked in Panel 2 I have no idea why it behaves differently in Panel 1 aside from weird, complex code interactions. Putting that aside, perhaps setting AutoScale to false will just sidestep the issue. Go to the StrategyPlot() indicator and in the Initialize() method just add "AutoScale = false;". See if that does anything for you.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              sorry Josh...I did not see that you had replied after Ray

              again, you have the instant fix....excellent....works fine...thanks....wish I had not wasted so much time chasing different solutions.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by tony_28217, Today, 07:04 PM
              0 responses
              3 views
              0 likes
              Last Post tony_28217  
              Started by flybuzz, Today, 10:33 AM
              1 response
              9 views
              0 likes
              Last Post flybuzz
              by flybuzz
               
              Started by spencerp92, 10-10-2023, 09:56 AM
              4 responses
              303 views
              0 likes
              Last Post flybuzz
              by flybuzz
               
              Started by samish18, Yesterday, 10:13 AM
              1 response
              25 views
              0 likes
              Last Post NinjaTrader_Eduardo  
              Started by Austiner87, Today, 05:02 PM
              0 responses
              6 views
              0 likes
              Last Post Austiner87  
              Working...
              X