• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator scale

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

    indicator scale

    Hello, i have an indicator i wrote which compare some values of instruments added using AddDataSeries in the configure section.

    What i wanted to ask was - i save the calculated values then plot and ema of the saved series of values and this is plotted in onbarupdate using the
    AddPlot(new Stroke(Brushes.Red, 2), PlotStyle.Line, "Correlation");

    So when i add the indicator to the chart i am adding to the same panel as price and on the left. I have set autoscale to both false and true in my tests and doesnt seem to make difference.

    The problem is initially the scaling looks fine .. showing the values on the scale relevant to the actual values in the visible chart range - then periodically the scale adjust to include
    the entire range for the loaded chart - this has the effect of flatlining the line plot since it is scaling to the range for all the plots since the first bar and not just the values in the range.

    Is there something i am missing or need to do here when using the plot set in onbarupdate?

    I have other code that uses Onrender in other indicators which draws based on the values in the visible screen range.

    What is it that is affecting the scale to go from the actual range for bars in visible chart to then the entire scale since the first bar?

    thanks

    #2
    Hello explorer101,

    Thank you for your post.

    When you say "then periodically the scale adjust to include the entire range for the loaded chart" do you mean when you manually adjust the scale so all bars are on screen? Would you be able to provide screenshots of the behavior you're referring to?


    To send a screenshot with Windows 7 or newer I would recommend using the Windows Snipping Tool.

    Click here for instructions

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and post the file as an attachment.

    Click here for detailed instruction

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello, ive enclosed some graphics of indicator which uses AddDataSeries for 1minute period and this is a 1min ES chart
      You can see the line flat in the ninja***1 image - then i scroll slightly right and the indicator appears as normal with the correct scale for the value in display in ninja**2
      I also scrolled to the first bars and you can see the initial values - whatever the data read in those first bars that is the value at that time in ninja**3
      I then scroll just past those bars and you see in ninja**4 the correct scale for the displayed values in the plot

      So the question is why is it showing those lower values when they are not in range in the visible portion of the chart ? So why is the scale showing as in **1 ?
      It seems to initially be ok then resets to the expanded value to include all values since the first bars loaded. As per my initial question.

      i stripped this to use standard ninja bars as was using on custom bar chart but you can see the issue is the same on standard minute chart

      thanks
      Attached Files

      Comment


        #4
        hello, not heard back yet but here also is the properties of the scales in the price panel on left and right.
        So is clearly set to screen date range ... yet the values on the left are outside of the bounds of this ?
        is happening again as i test this where it flatlines ... and there are no values in the range of the scale when it shows this
        Attached Files

        Comment


          #5
          Hello explorer101,

          Thank you for your reply.

          I wouldn't be able to tell exactly what's going on with the indicator unless I took a look at at least the code you're using to plot. However, I don't believe it's the scaling that's the issue, it looks like perhaps something isn't being recalculated as things move. The price and the indicator are working on separate vertical scales; those have no bearing on the other. However, the horizontal time scale is shared by both.

          Are you calculating any of the plot values outside of OnBarUpdate? Any code samples you can provide showing how you're calculating and plotting would be helpful.

          Thanks in advance; I look forward to assisting you further.
          Kate W.NinjaTrader Customer Service

          Comment


            #6
            In reviewing the code - the initial part i am looking at in terms of how many BarsRequiredToPlot - from the calculated data stored as a series - i then do an EMA of period 5.
            So for purposes of the display i guess the plot needs to start near 0 as this is how the plot works?

            Anyways that aside - what i think may be occurring is that the main instrument on the chart is ES for example - i am doing a calculation on some instruments in the indicator added with AddDataSeries - and in onbarupdate i was trying to use on price change . on each tick - in terms of the calculation part. I changed to onbarclose for now.
            I think the issue may be that there were no ticks or price changes in the instruments being calculated vs the ES which is obviously more active.

            In the code where i process
            if (BarsInProgress == 0)
            {
            Cumulative[0] = (Closes[2][0]/Closes[1][0])*weightLeg2;

            // next step calculate ema of the cumulative series

            Correlation[0] = EMA(Cumulative,weightLeg1)[0];

            }

            so ES is BarsInProgress 0 - what happens if there was no new bar for either Closes[2] or Closes[1] - this is based on 1 minute data series - so i would presume there would be a new bar.

            But it seems to in trying to process on each tick / on each price change - results in the line as i described above going flat and the scale screwing up to include the entire range as i explained before

            any insights?

            thanks

            Comment


              #7
              Hello explorer101,

              Thank you for your reply.

              Are you ensuring you have enough bars for each data series you've added?

              As before, I really wouldn't be able to tell you too much about what may be happening without looking at your script and testing. However, I would encourage you to add prints to your script so you can tell what the values of your variables are at times when the indicator isn't plotting as you'd expect.

              This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

              https://ninjatrader.com/support/foru...ns-not-working

              If you run into issues like you are seeing here, the above information will allow you to print out all values used in the condition in question that may be evaluating differently. With the printout information you can assess what is different between the values produced by the strategy and the values you'd expect..

              Please let us know if we may be of further assistance to you.
              Kate W.NinjaTrader Customer Service

              Comment


                #8
                Hello, yes i am aware of using prints and do so and did so and nothing was apparent. As i said this seems to be working fine when using on bar close
                So i think you are missing perhaps the subtleties of what i am sharing here and that question on why it occurs with on each tick / on price change setting.

                You ask 'are you ensuing you have enough bars for each data series added? i am using many days data - and how would i ensure this for a series in indicator AddDataSeries for 1 minute data?
                I dont believe that is the issue

                Perhaps i can separately send the script to you outside of this forum - how can i email this to you ? via platfform support ?

                thanks

                Comment


                  #9
                  Hello explorer101,

                  Thank you for your reply.

                  Yes, please send an email with your script attached to platformsupport [at] ninjatrader [dot] com. Please put 2273512 ATTN Kate W. in the subject line and a link to this forum post in the body.

                  Thanks in advance; I look forward to resolving this for you.
                  Kate W.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by RandanAL, Today, 09:05 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post RandanAL  
                  Started by cstern71, 09-02-2019, 10:30 AM
                  4 responses
                  59 views
                  0 likes
                  Last Post Lancer
                  by Lancer
                   
                  Started by Hanstanz, Today, 04:44 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post Hanstanz  
                  Started by juniortut, Today, 04:38 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post juniortut  
                  Started by rojiinko, Today, 03:58 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post rojiinko  
                  Working...
                  X