Berlin, Europe
Market Wizard
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102
|
If you do it this way and set the indicator/ strategy to CalculateOnBarClose = false, the indicator/strategy would perform a complex calculation with every incoming tick. However, this is creating an unnecessary CPU load.
It would be more efficient to declare two variables of type double to store the current high and low, then declare two variables of type int to store the bar count of current high and current low. You just would need check for the first bar of a session and set highCount and lowCount to 1, respectively currentHigh and currentLow to the high and low of the first bar. Then update with every new bar, if necessary.
|