Support Board
Date/Time: Wed, 27 Nov 2024 02:41:33 +0000
[Programming Help] - If statement not working
View Count: 238
[2023-09-23 00:29:32] |
User373245 - Posts: 42 |
Is there an issue using the S1ValArray[sc.Index] format in an if statement. currentPrice, S1ValArray[sc.Index] and S2ValArray[sc.Index] all go to the log correctly (the logging is not in this code) but this logic puts false in the log?????? The timing of it all is as should be, current price is > S1ValArray[sc.Index]and < S2ValArray[sc.Index] if (currentPrice > S1ValArray[sc.Index] && currentPrice < S2ValArray[sc.Index]){ sc.AddMessageToLog("Condition is TRUE", 1); } else { sc.AddMessageToLog("Condition is FALSE", 1); } |
[2023-09-23 15:07:10] |
Ticks - Posts: 183 |
What are you using to debug your code? If you are using Visual Studio. You can place breaks to check your code. You can also write to the sc.AddMessageToLog the values you are trying to compare. I assume currentprice is a value holder. So what are you stuffing into it? |
[2023-09-23 17:57:16] |
User373245 - Posts: 42 |
I actually see it! I was cooked in my mind(code binge) and the market go down decrease to increase < > logic was flipped!
|
To post a message in this thread, you need to log in with your Sierra Chart account: