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

Updating Plot Values on COBC = false

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

    Updating Plot Values on COBC = false

    Hi,

    I am running a chart with COBC = false and updating plot values on each tick.

    Values[i].Set(Math.Min(Values[i][1], Instrument.MasterInstrument.Round2TickSize(Low[0] + keyValue[i])));

    The issue is that the plot is not updating in real time to reflect the values being set. I know I can fix this by refreshing the ChartControl but I would rather not - performance issues. Is this a data binding issue with the plots? Can someone suggest a possible solution? Thank you.

    #2
    Originally posted by Zeos6 View Post
    Hi,

    I am running a chart with COBC = false and updating plot values on each tick.

    Values[i].Set(Math.Min(Values[i][1], Instrument.MasterInstrument.Round2TickSize(Low[0] + keyValue[i])));

    The issue is that the plot is not updating in real time to reflect the values being set. I know I can fix this by refreshing the ChartControl but I would rather not - performance issues. Is this a data binding issue with the plots? Can someone suggest a possible solution? Thank you.
    Without knowing the values that you are getting, you are using a Math.Min() method. I would expect that most of the time, the Plot value would be static. After all. for the Plot to change, the second term would have to be and stay below the previous recorded value from one bar ago. IOW, your Plot is monotonically decreasing or flat.

    Comment


      #3
      Thank you. That is true except that he plot values are not updating in real time. I will check it out.

      Comment


        #4
        Originally posted by Zeos6 View Post
        Thank you. That is true except that he plot values are not updating in real time. I will check it out.
        I think that I may not have explained it properly then, so let my try again.

        The ONLY time that you will see a change in the Plot is if, and only if, the value of Instrument.MasterInstrument.Round2TickSize(Low[0] + keyValue[i] goes and stays below the Plot value on the previous bar.

        Even in realtime, if that aforesaid value dips below the previous value, then goes back above it, the Plot will revert to the capped value. If that dip and jump happens within the chart refresh period, you will not even see that blip.

        Comment


          #5
          Hi koganam,

          I think you hit the nail on the head. That is exactly what is happening. I understand about the monotonic decreasing aspect and that is fine. The issue is that I see the dip, as you say, and if the value rises above the cap value the plot does not change. What I am after is to have the plot reflect the new dip value as soon as the dip takes place. Any suggestions as to how I can achieve this? Any suggestions would be greatly appreciated. Thank you.

          Comment


            #6
            Originally posted by Zeos6 View Post
            Hi koganam,

            I think you hit the nail on the head. That is exactly what is happening. I understand about the monotonic decreasing aspect and that is fine. The issue is that I see the dip, as you say, and if the value rises above the cap value the plot does not change. What I am after is to have the plot reflect the new dip value as soon as the dip takes place. Any suggestions as to how I can achieve this? Any suggestions would be greatly appreciated. Thank you.
            The first thing to do would be to straighten out your logic. Once you do that, translating it into code is no longer a chore. As an aside, you seem to be indexing these values. As I have no knowledge of your indexing scheme, I am only going to show you one way to do it using a single Plot. You will have to handle massaging the method into your code all on your lonesome.

            From what you describe, then, what you really want is to have your Plot be the lower of your delta function, and the previous plot. What that means logically then, is also that your previous plot can only be of use at the start of the bar, not a consistent comparative value. That leads me to this logic:
            1. When a new bar starts, store the value of the Plot for the previous bar.
            2. On each tick, the Plot on the current bar is the least of the current stored value and the current delta function.
            The former teacher in me says that I should leave you to code that, because I believe that you can. If you still need help, holler.

            Comment


              #7
              Hi koganam,

              Funny that you mention this approach. That is exactly the approach I took. I am now using:

              plotTestValue[i] = Math.Min(plotTestValue[i], Instrument.MasterInstrument.Round2TickSize(Low[0] + keyValue[i]));
              Values[i].Set(plotTestValue[i]);

              where on the first tick of each bar I set the plotTestValue as:

              for (int i = 0; i < 6; i++) plotTestValue[i] = Values[i][1];

              I am using this on financial data and can only test it properly when the markets are moving - in other words, later tonight or tomorrow.

              BTW, the indexing simply reflects the fact that I am plotting five plots. First plot is Values[0], and so on.

              Thank you for you help. :-)

              Comment


                #8
                This worked well. Thanks koganam. :-)

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by guillembm, Yesterday, 11:25 AM
                2 responses
                9 views
                0 likes
                Last Post guillembm  
                Started by junkone, 04-21-2024, 07:17 AM
                9 responses
                68 views
                0 likes
                Last Post jeronymite  
                Started by trilliantrader, 04-18-2024, 08:16 AM
                4 responses
                18 views
                0 likes
                Last Post trilliantrader  
                Started by mgco4you, Yesterday, 09:46 PM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by wzgy0920, Yesterday, 09:53 PM
                0 responses
                10 views
                0 likes
                Last Post wzgy0920  
                Working...
                X