Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 15:47:07 +0000



[Programming Help] - howto break(for) loop at first bar in history?

View Count: 669

[2018-04-29 21:41:52]
TedMar - Posts: 189

...
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 ?
}
...
..
if not break the loop at first histry bar and "for" is true , then freezes Sierrachart.
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: 189
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
}

after add "sc.Index == 0" , doesn't work fill the loop "true" space in subgraph. in dont understand stand why? Any idea to resolve this problem?

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

Login

Login Page - Create Account