Login Page - Create Account

Support Board


Date/Time: Tue, 16 Apr 2024 21:42:40 +0000



sc.AddLineUntilFutureIntersection problem

View Count: 807

[2018-07-19 15:31:47]
MD236 - Posts: 28
Hi,

for an advanced study I need to draw 1 or 2 lines until further intersection within manual looping in an numbers bar chart.
Sometimes I need to draw a line on the top and the bottom of an chart, each one as single works but if I try to draw both, then only the last function call draws a line. I attached an chart showing the problem, only the upper line is drawn.
I isolated the code and the goal is to draw both lines, what's wrong in my code?

Thanks
Mario


SCSFExport scsf_MD_Test(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults
    sc.GraphName = "MD_Test";
    sc.GraphRegion = 0;
    sc.AutoLoop = 1;
    sc.FreeDLL = true;
  }
  int &LongIndex = sc.GetPersistentInt(0);
  int &ShortIndex = sc.GetPersistentInt(1);

  sc.AddLineUntilFutureIntersection
    (sc.Index
      , LongIndex++
      , sc.Low[sc.Index]
      , RGB(252, 247, 129)
      , 2
      , LINESTYLE_DOT
      , false
      , false
      , ""
    );
  sc.AddLineUntilFutureIntersection
  (sc.Index
    , ShortIndex++
    , sc.High[sc.Index]
    , RGB(0, 128, 128)
    , 2
    , LINESTYLE_DOT
    , false
    , false
    , ""
  );
}


imagechart.png / V - Attached On 2018-07-19 15:30:40 UTC - Size: 24.64 KB - 216 views
[2018-07-19 21:03:04]
Sierra Chart Engineering - Posts: 104368
The LineIDForBar parameter must be unique for each line of the same chart bar index. These should not be separate variables:

int &LongIndex = sc.GetPersistentInt(0);
int &ShortIndex = sc.GetPersistentInt(1);
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
[2018-07-20 08:40:58]
MD236 - Posts: 28
Oh, interesting and it works

Thank you
Mario

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

Login

Login Page - Create Account