Support Board
Date/Time: Sun, 19 Jan 2025 17:57:00 +0000
[Programming Help] - howto break(for) loop at first bar in history?
View Count: 737
[2018-04-29 21:41:52] |
TedMar - Posts: 190 |
... sc.AutoLoop = 1; ..... .. // LOOP for (int i = 1; MovingAverage1[sc.Index -(i)] > MovingAverage2[sc.Index -(i)];i++) { howto Break loop at first bar in history ? } ... .. Date Time Of Last Edit: 2018-04-29 21:43:46
|
[2018-04-29 22:19:35] |
Sierra Chart Engineering - Posts: 104368 |
To check for the first bar you need to use: sc.Index == 0
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 Date Time Of Last Edit: 2018-04-29 22:19:46
|
[2018-04-30 08:45:14] |
TedMar - Posts: 190 |
hmm, the (for)loop count bars from latest (Current Bar right in chart) to left bar in chart (first bar in history sc.index == 0). But howto check first bar after increment before starts next loop? I tryed example : sc.AutoLoop = 1; .... ... //LOOP for (int i = 1; sc.Index == 0 && MovingAverage1[sc.Index -(i)] > MovingAverage2[sc.Index -(i)];i++) { sc.Subgraph[0][sc.Index - (i)] = [sc.Index - (i)]; // fill arrows between Avg1 > Avg2 } |
To post a message in this thread, you need to log in with your Sierra Chart account: