Login Page - Create Account

Support Board


Date/Time: Mon, 06 May 2024 17:26:48 +0000



sc.IsFullRecalculation

View Count: 1008

[2019-03-02 19:27:44]
User982736 - Posts: 46
I am trying to use code I found from the examples that call IsFullRecalculation function.

I found that if I call that code as they did, the 20 period moving average is not returning
the correct value. If I comment that call out the moving average is correct.

When is it appropriate to use this function and why does the moving average not calculate
correctly when using it?

  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)
  {
    sc.GraphName = "Trade Test Daily PL";

    sc.AutoLoop = 1; //Automatic looping is enabled.
    
    return;
  }

  // Section 2 - Do data processing
  
  if (sc.IsFullRecalculation)
    return;

  sc.MovingAverage(sc.BaseDataIn[SC_LAST], sc.Subgraph[1], MOVAVGTYPE_EXPONENTIAL, 20);
  float MovingAverage = sc.Subgraph[1][sc.Index];
  SCString MessageString;

  MessageString.Format("EMA: %.2f", MovingAverage);
  sc.AddMessageToLog(MessageString, 0);
[2019-03-02 22:36:46]
Sierra Chart Engineering - Posts: 104368
if (sc.IsFullRecalculation)
return;
This code must be removed.

Using that variable would be to perform certain initialization during a full recalculation but not returning before performing the data processing.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2019-03-02 22:37:02

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account