Login Page - Create Account

Support Board


Date/Time: Tue, 04 Mar 2025 17:52:07 +0000



[Programming Help] - Decrementing for loop

View Count: 498

[2021-12-27 06:11:14]
User769783 - Posts: 191
Hello,
In my for loop, I am trying to decrement instead of incrementing the integer. Is it possible? Am I doing something wrong? Thanks
...
for (int Ticks = sc.Bid; Ticks >= sc.Low[sc.Index]; Ticks--)
[2021-12-27 18:31:46]
ForgivingComputers.com - Posts: 1021
Yes, you can decrement Ticks with "Ticks--"

However, sc.Bid is not an integer so Ticks will get truncated. Depending on the prices you are looking at that could make a big difference. It could also cause the loop to never execute if sc.Low is greater than the truncated Ticks value.

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

Login

Login Page - Create Account