Heiken Ashi - color of the current bar in robot
Heiken Ashi - color of the current bar in robot
12 Sep 2013, 09:31
Hi, I'm using in my robot the Heiken Ashi Indicator and would like to determine the color (blue or red) of the current candlestick. How can I do that? Thanks
Replies
Cerunnos
15 Sep 2013, 09:25
( Updated at: 21 Dec 2023, 09:20 )
RE: RE:
fzlogic said:
protected override void OnBar() { // Put your core logic here var index = heiken.closeha.Count - 1; if (heiken.closeha[index] > heiken.openha[index]) Print("green"); else Print("red"); }I think that for the last bar it may not produce correct results. Notice in the screenshot how there is both colors in certain candles.
Thanks for help. I have one more question in this context. Within my Robot I'm using OnTick () method instead of onBar (). But I need some kind of bar-counter:
If a bar has the color blue in the next three bars and a further condition is given, then the robot should enter an order. How can I do that? Thanks
@Cerunnos
fzlogic
30 Oct 2013, 15:05
( Updated at: 21 Dec 2023, 09:20 )
RE: RE: RE:
Cerunnos said:
fzlogic said:
protected override void OnBar() { // Put your core logic here var index = heiken.closeha.Count - 1; if (heiken.closeha[index] > heiken.openha[index]) Print("green"); else Print("red"); }I think that for the last bar it may not produce correct results. Notice in the screenshot how there is both colors in certain candles.
Thanks for help. I have one more question in this context. Within my Robot I'm using OnTick () method instead of onBar (). But I need some kind of bar-counter:
If a bar has the color blue in the next three bars and a further condition is given, then the robot should enter an order. How can I do that? Thanks
What do you mean next three bars? You mean if a bar has the color blue in the previous three bars?
for (int i = index; i > index - 3; i--) { if (heiken.closeha[index] > heiken.openha[index]) continue; //blue red = true; break; } if (!red && condition) ExecuteOrder(TradeType);
@fzlogic
fzlogic
12 Sep 2013, 16:05 ( Updated at: 21 Dec 2023, 09:20 )
RE:
Cerunnos said:
I think that for the last bar it may not produce correct results. Notice in the screenshot how there is both colors in certain candles.
@fzlogic