Support Board
Date/Time: Mon, 24 Feb 2025 01:21:15 +0000
Post From: reseting calculation every day
[2021-02-23 03:02:23] |
Flipper_2 - Posts: 57 |
Normally you would track in a Persistent variable the value you are reseting every day, for example the daily High. On the start of the day clear and reset it. SCDateTime TradingDayStartDateTime = sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[sc.IndexOfLastVisibleBar]); SCString dateTime = sc.FormatDateTime(TradingDayStartDateTime).GetChars(); auto StartIndex = sc.GetFirstIndexForDate(sc.ChartNumber, TradingDayStartDateTime.GetDate()); float& DlyHigh = sc.GetPersistentFloat(0); // Day re-starts on this Bar so reset your variables in here if ( StartIndex == sc.Index) { DlyHigh = sc.BaseDataIn[SC_HIGH][sc.Index]; // or whatever value you want to reset to like = 0 } else if(sc.High[sc.Index] > DlyHigh){ DlyHigh = sc.High[sc.Index]; } Date Time Of Last Edit: 2021-02-23 03:04:45
|