Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MTF SMA plot issue

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

    MTF SMA plot issue

    Hello dear friends, i have a sma mtf indicator calculation is right but when i plot it, it shifts.
    Here is the code
    Code:
    else if (State == State.Configure)
                {
                    AddDataSeries(Data.BarsPeriodType.Minute, TimeFrame);
                }
                else if (State == State.DataLoaded)
                {
                    // Syncs a DataSeries object to the primary bar object
                    primarySeries = new Series<double>(this);
    
                    /* Syncs another DataSeries object to the secondary bar object.
                    We use an arbitrary indicator overloaded with an ISeries<double> input to achieve the sync.
                    The indicator can be any indicator. The Series<double> will be synced to whatever the
                    BarsArray[] is provided.*/
                    secondarySeries = new Series<double>(SMA(BarsArray[1], SMAPeriod));
                }
            }
    
            protected override void OnBarUpdate()
            {
                  foreach(int CurrentBarForSeries in CurrentBars)
                  {
                    if (CurrentBarForSeries < 1)
                    {
                      return;
                    }
                  }
    
                Value[0]=SMA(Medians[1], SMAPeriod)[0];
    
            }
    What i am doing wrong?

    Thank you!
    Click image for larger version

Name:	exz.png
Views:	151
Size:	10.2 KB
ID:	1061388
    Attached Files

    #2
    Hello stoxos,

    Thanks for your post.

    Plots are synchronized to the primary data series. If your added plot is plotting data from a higher time frame than the primary data series, we will not have a more recent value for the plot until the that secondary bar closes and updates the value being plotted.

    If you use Calculate.OnPriceChange then each data series will update with incoming price changes and plot values will be calculated for the developing bars without having to wait for the secondary bar to close to update that plot. Please note that historical data will still process OnBarClose, so you could also move forward by having the primary data series as the higher time frame and the secondary series as the smaller time frame.

    Please let us know if you have any additional questions.​​

    Comment


      #3
      Yes you are right i tried OnPriceChange, but nothing changed. So i will pass that project. But thank you.
      P.S. To anyone else, this is not an issue on NT platform, apparently other platforms are also having hard time with multitimeframe data series.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X