Login Page - Create Account

Support Board


Date/Time: Wed, 15 May 2024 08:21:41 +0000



[Programming Help] - SC equivilent to NT8 script State.DataLoaded

View Count: 532

[2021-07-11 20:48:36]
JohnR - User831573 - Posts: 300
So, I'm migrating some code from NT8, and there is some code that executes in here
... if (State == State.DataLoaded)

NT8 docs state -This state is active when all data is loaded.
This is where you should
.....
•Use for logic that needs to access data related objects like Bars, Instruments, BarsPeriod, TradingHours or instantiating indicators
•Notify that all data series have been loaded
•Initialize any class level variables (including custom Series<T> objects)
.....

I think my question is... when in SC will I know what the "Tick Size" is? Can I add this type of code to the sc.SetDefaults area of coding?
  // Section 1 - Set the configuration variables and defaults
  if (sc.SetDefaults)

JohnR

Also, is there a variable I can check to know if I am processing historical or real time data?


If any one is interested, the below code is what is within the If (State == State.DataLoaded)


// Calculate decimal places
decimal increment = Convert.ToDecimal(Instrument.MasterInstrument.TickSize);
int incrementLength = increment.ToString().Length;
decimalPlaces = 0;
if (incrementLength == 1)
decimalPlaces = 0;
else if (incrementLength > 2)
decimalPlaces = incrementLength - 2;
  if (SwingType != SwingStyle.Percent)
  {
SwingSize = SwingSize < 1 ? 1 : Math.Round(SwingSize, MidpointRounding.AwayFromZero);
  }
  displayName = Name + "(" + Instrument.FullName + " (" + BarsPeriod.Value + " " + BarsPeriod.BarsPeriodType + "), " + SwingType + ", " + SwingSize + ", " + DtbStrength + ")";
swingProperties = new SwingProperties( SwingSize, DtbStrength);
}

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

Login

Login Page - Create Account