Support Board
Date/Time: Fri, 10 Jan 2025 20:22:33 +0000
Arithematic doesn't work
View Count: 748
[2016-10-07 02:39:10] |
bala - Posts: 74 |
Here is a simple code used on your simple moving average function: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ float x1; float testsum; if (sc.Index == 0) {testsum = 0;} If (sc.Index >0) { x1=sc.BaseDataIn[SC_LAST][sc.Index]; testsum += x1; SCString Buffer; Buffer.Format("Test by %d -%f - %f",sc.Index,x1,testssum); sc.AddMessageToLog(Buffer, 1); } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++it's The above doesn't update testsum at all despite being in loop!! A similar loop works fine in visual c++. What am I doing wrong..? |
[2016-10-07 04:25:30] |
Sierra Chart Engineering - Posts: 104368 |
We do not see any for loop and because most likely you are using Automatic Looping, none of those locally defined variables are persistent. You need to use persistent variables: sc.GetPersistentInt() 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 |
[2016-10-07 10:15:40] |
bala - Posts: 74 |
Thank you that was the issue and was resolved!!!!
|
To post a message in this thread, you need to log in with your Sierra Chart account: