• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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:	2
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.​​
    JimNinjaTrader Customer Service

    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 CandySNK, Today, 10:24 PM
      0 responses
      3 views
      0 likes
      Last Post CandySNK  
      Started by user1986, Today, 07:28 PM
      2 responses
      11 views
      0 likes
      Last Post NinjaTrader_EricB  
      Started by ericson, Today, 08:14 PM
      0 responses
      7 views
      0 likes
      Last Post ericson
      by ericson
       
      Started by jertrade, Today, 06:57 PM
      0 responses
      5 views
      0 likes
      Last Post jertrade  
      Started by Emma1, Today, 02:42 PM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_DrewO  
      Working...
      X