Hi
How do I write the code if I want too identify wicks on previous Heiken-Ashi candle? I want too be able too identify if previous red Heiken has no wick on the upper side and if previous green Heiken has no wick on the lower side.
There you go (not tested):
once xOpen = open
xClose = (open + close + high + low) / 4
if barindex > 0 then
xOpen = (xOpen + xClose[1]) / 2
endif
xLow = min(low,min(xClose,xOpen))
xHigh = max(high,max(xClose,xOpen))
//xTypic = (xHigh + xLow + xClose) / 3
//xMed = (xHigh + xLow) / 2
//xRange = xHigh - xLow
Bullish = xClose > xOpen
Bearish = xClose < xOpen
Red = Bearish AND (xOpen = xHigh)
Green = Bullish AND (xOpen = xLow)
RED is the current candle, RED[1] is the previous one, RED[2] is the second previous one, and so on….
The same is true for GRREN candles.
Thanks, where do I put the [1] too get the previous Heikin?
Im totally off.. how does the code look with the previous candle?
As I said, RED is the current candle, RED[1] is the previous one, RED[2] is the second previous one, and so on….
You need to watch some videos about programming at https://www.prorealcode.com/programming-with-prorealtime/, or at https://www.prorealtime.com/en/videos_tutorial-trading and on the ProRealTime’s YouTube channel.
Moreover, reading documentation at https://trading.prorealtime.com/en/programming-help and some of the thousands of code examples in this forum may further help.
We cannot take a complete course post after post!
Tnx, I can agree that i must learn more. But anyway, thanks for the support.
You have everything in Roberto’s code.
Here a version that you can put under your chart with “barchart” for green and red parameters OR on your graphs with arrows for No-Wicks candles.
once xOpen = open
xClose = (open + close + high + low) / 4
if barindex > 0 then
xOpen = (xOpen + xClose[1]) / 2
endif
xLow = min(low,min(xClose,xOpen))
xHigh = max(high,max(xClose,xOpen))
//xTypic = (xHigh + xLow + xClose) / 3
//xMed = (xHigh + xLow) / 2
//xRange = xHigh - xLow
Bullish = xClose > xOpen
Bearish = xClose < xOpen
Red = Bearish AND (xOpen = xHigh)
Green = Bullish AND (xOpen = xLow)
if Green then
drawarrowup(barindex,lowest[3](low)) coloured(0,255,51)
endif
if Red then
drawarrowdown(barindex,highest[3](high)) coloured(102,102,102)
endif
return red as "red" , green as "green"
I think I sorted the 1st issue with crosses under and over. Now I am getting the right alert.
Still need help with calculating number of points from last top or bottom to current price, it’s difficult to get around on my own, please help?
never mind, all sorted now,, thanks!
@amitoverseas40, how did you to have the arrows on the right place? Thanks in advance