Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 05:15:30 +0000



Post From: sc.BaseDataIn[][] Question

[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.