Help About CBot based on renko charts
Created at 09 Aug 2023, 12:08
Help About CBot based on renko charts
09 Aug 2023, 12:08
Good morning,
I would need to recover the following information
-Catch the creation of the new brick
-Get the color of the last brick
How i can do it?
Thanks
firemyst
10 Aug 2023, 00:31
When the “OnBar” event happens.
Or write your own in the “OnTick” method:
_currentIndex = Bars.OpenTimes.GetIndexByTime(Bars.OpenTimes.LastValue);
if (_currentIndex != _previousIndex)
{
//Call your own OnBar method
OnBarForBot();
_previousIndex = _currentIndex;
}
Do you mean actual color? Or is what you really want to know whether the bar closed up or down?
I'll assume the latter since most bots/indicators don't care about actual colors - just check if the previous close price is > or < the previous open price.
if (Bars.ClosePrices.Last(1) > Bars.OpenPrices.Last(1))
///bullish bar
else
///bearish bar
@firemyst