Support Board
Date/Time: Thu, 27 Feb 2025 12:08:20 +0000
[User Discussion] - OrderFlowAnalitics style Reversal Bars. New version.
View Count: 869
[2021-01-28 12:17:57] |
norvik_ - Posts: 106 |
Hi. Recently I had made a huge set of backtests applying strategy to the chart with my old version of this custom bars, and I had found, that it works very slow. Two much time for loading data and calculating custom bar study. So I decided to try make this using new SC interface for building custom bars. New code is really fast, saving a lot of time. During revision my old study, several things found, which is not entirely true. First one, "new bar on session start" condition is incorrect. if (i == 0 || ((sc.BaseDateTimeIn[i-1].GetDate() != sc.BaseDateTimeIn[i].GetDate())
should be replaced with n_ACSIL::s_ChartSessionTimes SessionTimes;
sc.GetSessionTimesFromChart(sc.ChartNumber, SessionTimes); if (i == 0 || ((sc.BaseDateTimeIn[i-1].GetTimeAsSCDateTime() != SessionTimes.StartTime)&& (sc.BaseDateTimeIn[i].GetTimeAsSCDateTime() == SessionTimes.StartTime))) Second concerning a range of bar. There are several definitions of range bars, SC chart settings allow you to use five different types. And for our case, in my opinion, only one type is preferred, this is the 'true range in ticks" with no adjustment for open or close values. But old study version contains this formula for range caculation: float prevClose = firstBar ? Open[o] : Close[o-1]; float hi = max(max(HighO, HighI), prevClose); float lo = min(min(LowO, LowI), prevClose); float trueRange = hi - lo; So, close price of prior bar is always included in range if current bar. However, since there are no strict rules for this, I simply have added an additional input in new version for users can decide themselves, how to calculate range of bar, including prev close or not. It's a pity that FormattedEvaluate fuction is missed in s_CustomChartBarInterface, so my own bicycle was invented for correct comparison floating point values: float RoundToValueFormat(SCCustomChartBarInterfaceRef Interface, float Value)
{ (Interface.ValueFormat > 0 && Interface.ValueFormat < 7)? return std::roundf(Value * (float)std::pow(10, Interface.ValueFormat)):return Value; // Can be extended for all cases using 'switch' operator } full source and compiled *dll in attachment. |
![]() |
[2021-01-28 13:27:48] |
|
FormattedEvaluate fuction is missed in s_CustomChartBarInterface, We will add this.
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 |
[2021-06-29 12:53:35] |
User907968 - Posts: 833 |
Looking at 'ACSILCustomChartBars.h', I guess this was not quite completed yet?
|
To post a message in this thread, you need to log in with your Sierra Chart account: