No announcement yet.

Partner 728x90


Error in chart charge

  • Filter
  • Time
  • Show
Clear All
new posts

    Error in chart charge

    Hello dears,

    I have a problem in a strategy, please can you help me to fix it?

    Is a MultiTimeFrame and MultiIndicator Strategy, for TF1 I use Chart Back Color and for TF2 Candle Color.

    Here the position of the related code...

    (State == State.SetDefaults)
    TF1Type = BarsPeriodType.Volume;
    TF1Period = 50000;
    TF1Indi = tf1Indi.Macd_Ema;

    (State == State.Configure)
    AddDataSeries(TF1Type, TF1Period);

    (State == State.DataLoaded)

    if (_TF1Macd == null)
    _TF1Macd = MACD(BarsArray[1],12,26,9);


    if (BarsPeriod.BarsPeriodType == TF1Type && BarsPeriod.Value == TF1Period)

    switch (TF1Indi)
    case tf1Indi.Macd_Ema:
    } break;

    I have set that only when I choose to visual the same Chart of TF1 it show the indicator ...otherwise I see only color of the chart.

    This is for volume/50000 (TF1) to see the indicators

    Error 1: if the strategy is running changing TF (period or type). example choosing volume 10000. The indicators desappear but leave a "white space below"

    Error 2: If the strategy is running and I choose the TF1 to see the indicator. The indicators open in the "panel chart"

    All came back right with disable/enable the strategy (or re-setting the same period/type value of the chart).

    Any idea about fix it please? Many thanks.

    Hello ClauTrade,

    Thanks for opening the thread.

    I see that you are adding a data series dynamically in your example. This is not fully supported and may be causing some unexpected behavior that we are seeing. If you make this DataSeries static, (for example, hard coding the BarsPeriodType and value) do you still encounter issues?

    Issue 2 may be related to the logic controlling AddChartIndicator(). Do you see any relevant prints in the output window when you add prints to your logic controlling AddChartIndicator() when you reproduce the error?

    If the troubleshooting questions above do not lead you towards a resolution, could you provide a reduced sample that exhibits the issue without doing anything else? For example, irrelevant parameters removed and any OnBarUpdate() logic or code unrelated to the issue removed?

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


      Hello Jim,

      many thanks for your suggest and for fast reply.
      I tryed all your purpose but nothing have change.
      I prepared a basic sample of the strategy ready to try.

      I hope we can solve it... many thanks!
      Attached Files


        Hello ClauTrade,

        Thanks for the example.

        As I am observing, you are adding a data series dynamically to supply your indicators. This is not always guaranteed and is thus unsupported. When the indicator is added upon strategy enable and the secondary series matches the primary, the strategy happens to work.

        However, when the data series changes or does not match the primary, and since the additional data series is not included with your added indicators, the indicators would not have a valid data series to calculate from.

        To meet your goal, you could create new instances of your indicators that have the data series baked into them, and then you could select the indicator to use from a UI property.

        Keep in mind that indicators must have their own data series baked into them and must have that data series added to the strategy as well. These must be hardcoded.

        From the help guide:
        An indicator being added via AddChartIndicator() cannot use any additional data series hosted by the calling strategy, but can only use the strategy's primary data series. If you wish to use a different data series for the indicator's input, you can add the series in the indicator itself and explicitly reference it in the indicator code (please make sure though the hosting strategy has the same AddDataSeries() call included as well)
        o If a secondary or null Bars series is specified by the calling strategy (not the indicator itself), the strategy's primary series will be substituted instead.

        As this issue results from a limitation of dynamically adding data series, I will submit a vote on your behalf to the feature request tracking this.

        Ticket ID: SFT-882.

        We cannot offer an ETA on feature request fulfillment and they are completed based on the development team's schedule and priorities.

        Fulfilled feature requests will be noted in the Release Notes page of the helpguide:

        Please let me know if I can be of further assistance.
        JimNinjaTrader Customer Service


        Latest Posts


        Topics Statistics Last Post
        Started by aeadon, Today, 02:27 AM
        0 responses
        Last Post aeadon
        by aeadon
        Started by op1031, Today, 01:52 AM
        0 responses
        1 view
        Last Post op1031
        by op1031
        Started by Aramunno, Yesterday, 10:11 PM
        2 responses
        Last Post Aramunno  
        Started by sdauteuil, Yesterday, 09:38 PM
        0 responses
        Last Post sdauteuil  
        Started by fscabrera03, Yesterday, 09:23 PM
        0 responses
        Last Post fscabrera03