Login Page - Create Account

Support Board

Date/Time: Sat, 25 Mar 2023 13:58:42 +0000

Post From: *IMPORTANT* Notice: Custom Study Improperly Altering Time Scale of Chart

[2020-12-04 20:38:22]
Ackin - Posts: 1851
If you are the developer of a custom study, never change the elements of this array:

Nobody changes it. The statement above is incorrect.

This error occurs after updating the SC when the user does not recompile the library (or when use a third-party library that is not recompiled to a newer version). This is related to the change in SCDateTime functionality described in the 2195 notes.

Try this code below recompiled in version 2192 and open Sierrachart 2204. You will get a result with zeros on the axis. (attached file)

SCSFExport scsf_example(SCStudyInterfaceRef sc)
  if (sc.SetDefaults)
    sc.GraphName = "Example";
    sc.GraphRegion = 1;
    sc.AutoLoop = 0;


    for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; BarIndex++)
      if (BarIndex > 0)
        SCDateTime PreviousTradingDayStartDateTimeOfBar = sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[BarIndex - 1]);
        SCDateTime TradingDayStartDateTimeOfBar = sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[BarIndex]);

This is not to say that you are doing something wrong. You warned in advance that libraries should be recompiled.

Just my opinion:
If the content of a feature changes significantly in this way, it should be a "forced update," not just a "recommended update."
Date Time Of Last Edit: 2020-12-04 23:11:08
imageLib_v2192_in_SC_v2204.png / V - Attached On 2020-12-04 20:36:37 UTC - Size: 36.94 KB - 353 views