Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator added via AddChartIndicator does not display historical info until reloaded

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

    Indicator added via AddChartIndicator does not display historical info until reloaded

    Hello,

    I use Version 8.0.18.0 64-bit.

    See the attached test files.

    I have a Strategy that calls AddChartIndicator().

    The Indicator is normally used as a troubleshooting tool with a SIM account, showing various Indicator data states across the chart as necessary. In the attached files, the test Indicator displays a piece of data in the lower panel every 10 bars using Draw.Text().

    I want to run the Strategy and see the historical data in the Indicator. However, when the Strategy is started, no historical information is shown in the Indicator unless I reload the Strategy while it is running. Note that new Indicator data does appear as the Strategy continues to run, even if the Strategy is not reloaded.

    How can I see the historical Indicator data without reloading the Strategy?

    Thank you.
    Attached Files

    #2
    Hello Zigfried,

    Thank you for your post.

    It looks like it wasn't correctly getting created.

    else if (State == State.DataLoaded)
    {
    Indicator01 = IndicatorTest();
    AddChartIndicator(Indicator01);
    ChartIndicators[0].Panel = 1;
    }

    I removed BarsArray[0] from IndicatorTest() and it now plots as expected without needing to use .Update().

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hi Kate,

      Thanks for the quick response.

      Yes, I confused the Inputs[0] default Indicator input with BarsArray[0]. Guess I was lulled to sleep on it since the Indicator calculations in my actual code were still correct when programmed like that.

      But that was only half the problem...it seems that leaving the Update() method in the Strategy also breaks it.

      In my actual Strategy code I am using Update() methods to retrieve some complex data objects from the Indicator via it's properties. So I will still have the same issue.

      Unless you have some other words of wisdom off the top of your head, forget about it. This should only be a minor inconvenience that arises during some testing activities.

      Thanks for your time.

      Comment


        #4
        Hello Zigfried,

        I wanted to check, was the intended goal to have the indicator display in a sub panel?
        I see that your sample works so long as I remove the following line:
        Code:
        ChartIndicators[0].Panel = 1;
        If it should be a sub panel, you should remove this code and I see that it works on the first apply as a sub panel.
        If it should be in the main panel, you would need to use
        Code:
        IsOverlay  = true;
        DrawOnPricePanel  = true;
        to have it moved to the primary panel.

        lease let us know if we may be of further assistance to you.

        Comment


          #5
          Hello Jesse,

          To answer your question, yes, I need to use the lower panel for these display elements. At one point the ChartIndicators code helped me to do this, or so I thought. I'm not sure what it may have fixed at the time, or what I may have changed since then, but it was obviously just a Bandaid because my actual code doesn't seem to need it now.

          Today I tested several combinations of Inputs[0] vs BarsArray[0], ChartIndicators vs NONE, and Update vs NONE.

          The conclusion...on the initial apply, the combination of ChartIndicators and Update can break some other things were working. For example, take the code that I sent you, and in the Indicator, change the Draw.Text line to the following:

          Draw.Text(this, "text"+CurrentBar, false, "HH", 0, 50, 0, Brushes.Cyan, ChartControl.Properties.LabelFont, 0, Brushes.Transparent, Brushes.Transparent, 0);

          When the test Strategy is started, the ChartControl object seems to temporarily go NULL, and after a reload, all is well. I assume that this behavior is either by design or unavoidable. I saw this happening before my original post but did not want to confuse the issue, so I did not mention it.

          In summary, removing ChartIndicators fully resolves all of my current NT8 issues.

          Thanks to Kate and Jesse for quickly solving this!

          Comment


            #6
            Hello Zigfried,

            Yes in this case I don't believe ChartIndicators[0].Panel = 1; was the correct solution for this use case. That can be used to move a panel, however you were already trying to overlay the indicator in that panel so it seems to cause some problem. Generally you should only need to use IsOverlay unless you specifically want to move it to a panel index directly, in that case ChartIndicators[0].Panel = index; can be used. As this was not directly a requirement in your syntax, I believe the best solution is to just omit that code as you have and use IsOverlay to control placement.


            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            56 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            132 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            73 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            45 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X