Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 13:25:12 +0000



sc.BaseDataIn[][] Question

View Count: 874

[2018-04-13 05:43:19]
User279534 - Posts: 4
I'm working on a system in which I would like to draw arrows at my exits when an attached Stop1Offset or Target1Offset is hit. I was having some issues getting it to work, and so I started adding messages to the log to see what value sc.High[sc.Index] was storing for every bar. To my surprise, the log showed multiple values for every date, and repeated the actual high value for every bar. Ex:

  int Year, Month, Day;
  sc.BaseDateTimeIn[sc.Index].GetDateYMD(Year, Month, Day);

  SCString LogicCheck;
  LogicCheck.Format("Target: %f, %d%02d%02d", sc.High[sc.Index], Year, Month, Day);
  sc.AddMessageToLog(LogicCheck, 0);

prints:

Chart: Bar Backtest: SIX Daily #1 | Study: Pullback System | Target: 62.139999, 20180412 | 2018-04-12 23:30:23
Chart: Bar Backtest: SIX Daily #1 | Study: Pullback System | Target: 61.410000, 20180412 | 2018-04-12 23:30:23
Chart: Bar Backtest: SIX Daily #1 | Study: Pullback System | Target: 62.299999, 20180412 | 2018-04-12 23:30:23
Chart: Bar Backtest: SIX Daily #1 | Study: Pullback System | Target: 62.299999, 20180412 | 2018-04-12 23:30:23
Chart: SIX Daily #1 | Study: Pullback System | Target: 62.299999, 20180412 | 2018-04-12 23:30:24

So it's giving me the high 3 times, and it's also giving me the low and the open. And it does that for every day. Is this how this function supposed to work? Based on the documentation, I thought that sc.High would be an array of all the highs in the chart, and sc.Index just referred you to the most recent variable stored in that array. Why does it then print the same variable 3 times, as well as printing the low and open? I didn't reference that array, so I'm confused as to why that happens. I don't know if this'll solve my issue re: drawing arrows at offset exits, but it caught my attention anyway.

I know it's policy to not necessarily answer programming questions, and so I'm not asking for help to solve my programming problem, just clarification on how the sc.BaseDataIn[][] array of arrays works.
[2018-04-13 18:38:46]
Sierra Chart Engineering - Posts: 104368
Refer to the documentation here:
Working with ACSIL Arrays and Understanding Looping
ACSIL Interface Members - Variables and Arrays: sc.CurrentIndex / sc.Index

There is no way we can answer your question because we do not even know what data is in the chart. And what array index sc.Index is even referring to. Ultimately your question is programming help because it requires detailed analysis on our part.
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

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

Login

Login Page - Create Account