Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error in chart charge

Collapse
X
 
  • 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...

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

    2.
    (State == State.Configure)
    {
    AddDataSeries(TF1Type, TF1Period);
    }

    3.
    (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:
    {
    AddChartIndicator(_TF1Ema);
    AddChartIndicator(_TF1Macd);
    } 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.







    #2
    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

    Comment


      #3
      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

      Comment


        #4
        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.
        https://ninjatrader.com/support/help...tindicator.htm

        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: https://ninjatrader.com/support/help...ease_notes.htm

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Franck Z, Today, 09:49 AM
        0 responses
        4 views
        0 likes
        Last Post Franck Z  
        Started by pvtrader, Today, 08:02 AM
        2 responses
        7 views
        0 likes
        Last Post pvtrader  
        Started by Natoc, Today, 03:04 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by Rudy2323, Today, 02:56 AM
        2 responses
        26 views
        0 likes
        Last Post Rudy2323  
        Started by tonynt, Yesterday, 02:07 PM
        1 response
        34 views
        0 likes
        Last Post NinjaTrader_Jason  
        Working...
        X