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

Chart Scale Changed After Applying Strategy

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

    Chart Scale Changed After Applying Strategy

    Hi,

    I finished developing a strategy but when I apply it to a chart, the vertical price scale is completely changed.
    It goes from this (before applying the strategy):




    To this:



    Based on previous experience with indicators, I noticed that very same behaviour when the "Auto-Scale" parameter was set to Yes.
    But for a Strategy, I can't see this parameter anywhere, so I'm wondering what could be causing this issue.
    Appreciate your help on this.

    Thanks!
    Attached Files
    Last edited by g49nep1f; 12-30-2019, 04:28 PM.

    #2
    Hello g49nep1f,

    This generally happens when something is applied which has a large difference from the current price. The autoscale does control this but is not something which you can set for a strategy its self.

    Are you doing any Plotting from the strategy directly, using drawing objects or adding indicators visually?

    The image doesn't provide much detail other than a value of 0 seems to be scaled in, I am not able to see an upper range for the price other than 0.25 so this could potentially be something else happening as well. Generally if the autoscale is involved we would see a full price range like 0 - 3232.

    If you have other items applied to the chart you may want to test applying the strategy by its self to make sure the problem still exists. Also applying the SampleMACrossOver to the chart can help diagnose problems, if the same problem happens with the sample it is not likely code related.



    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      I am indeed doing plotting in the strategy, but as you can see in the screenshot below, all the strategy is doing is print 2 lines above and below the current price (shown with the arrows), so it really shouldn't change the scale:
      Click image for larger version

Name:	NT8-StrategyExecute.png
Views:	175
Size:	30.4 KB
ID:	1082375
      Furthermore, I also tried commenting out the 2 lines that perform the drawing, but the scale change is still occurring as soon as I add the strategy to a chart.
      Is there anything else that comes to mind I should check ?
      I guess I'll have to go through the code and check every place to see what is causing the scale change.

      Comment


        #4
        Hello g49nep1f,

        If you had commented out the lines being used and that was not it there is likely still something else which controls this. If you don't see this happening with any other strategy it would be something in the code however I could not say what that may be from the given details. The only items which are scaled would be Plots, Drawing objects and Indicators so really those would be the key areas to take a look at in the script.

        If you can upload the script here I could take a look at it as well to see what sticks out otherwise yes you will need to do a little more investigation here.

        An easy way to find the required code is to comment out all of your code and find where the problem starts. For example comment out all of OnBarUpdate logic leaving just the OnBarUpdate override. Does it still happen? If so the problem is not likely related with what was commented so you could continue the search, otherwise if the problem stops you can now slowly uncomment the OnBarUpdate code to find when it starts again to pinpoint the problem.



        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          OK, applying the SMA CrossOver strategy causes the same problem, so I guess it's not something in my code, there is likely some config somewhere causing the problem

          Comment


            #6
            Hello g49nep1f,

            Can you check if this is a chart configuration by creating a new chart with no template or presets?

            From the control center click New -> Chart
            In the window make sure <None> is selected in the top right and before you click ok locate the "Preset" button in the lower right, click it and then click restore.

            If that stops the problem some chart setting is coming into play here and I can provide steps to clear the template/preset, otherwise if that does not help we will need to continue to troubleshoot here.

            Are there any other details surrounding the situation like using multiple series in the chart or selecting a specific input for the strategy?

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Thanks Jesse,

              I created a chart from scratch with zero indicator and both the sample SMA Crossover and my strategy work without causing the issue.
              So I guess one of the indicator I have on that chart is causing the issue.
              Can you provide more details on how to clear the template/preset as you mentioned above ?

              Thanks in advance!

              Comment


                #8
                OK, problem solved. Well, sort of. I used the new chart I just created and added back all my indicators. It's still working fine when I add the strategies.
                I suppose that chart I was using got corrupted somehow and caused that issue. I'll remember it if that issue occurs again.
                Thanks for your assistance anyway!

                Comment


                  #9
                  Hello g49nep1f,

                  Thanks for the update I am glad that has been resolved.

                  Just to clear up the other question you had, in case you do want to clear default templates, the templates are located in the folder:
                  Documents\NinjaTrader 8\templates and in a sub folder for the type of template.
                  Cleaning defaults for a chart would be in the folder ChartSeries and there will be corresponding .xml files for the series type.

                  It does sound like some kind of problem with the chart/template/settings that will be resolved by creating the new chart however if you see this happen again it could be caused by one of the other indicators as you noted. If you see this again I would suggest experimenting with removing the indicators first to see if you can pinpoint which item is associated with the problem.



                  I look forward to being of further assistance.

                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Just so you know, I had exactly the same problem. Added a strategy with no plots or indicators to a chart with indicators, and the chart just showed the zero line. I deleted the chart and recreated it and that fixed the problem. Thanks!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by DayTradingDEMON, Today, 09:28 AM
                    4 responses
                    21 views
                    0 likes
                    Last Post DayTradingDEMON  
                    Started by geddyisodin, Yesterday, 05:20 AM
                    9 responses
                    50 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by George21, Today, 10:07 AM
                    1 response
                    11 views
                    0 likes
                    Last Post NinjaTrader_ChristopherJ  
                    Started by Stanfillirenfro, Today, 07:23 AM
                    9 responses
                    23 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by navyguy06, Today, 09:28 AM
                    1 response
                    9 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X