211Participant
Senior
Hello dear PRT forum,
Can somebody help me with some coding? I tried to it myself, but I have no clue what to do and how to make it work.
I have 20 Weighted Moving Average, and when the 5th candle (in a uptrend) is above the 20 WMA, the candle changes in a different colour.
The same goes the vice versa, when the 5th candle (in a downtrend) is under the 20 WMA, the candle changes in a different colour.
Extra info: I use Heikin-Ashi candlecharts and a 25 tick chart.
Attached a pdf file visually explained
I hope somebody can help me with this.
Many thanks!
Fabius
This is a nice colored chart, well done.
Your request is possible, but drawing custom candlesticks and with different colors is only possible with v10.3. So if you are still using the 10.2 (IG users mainly), you’ll not be able to use the code.. You’ll have to wait for the 10.3 release for all users.
211Participant
Senior
Hi Nicolas,
Thanks for the reply. Can you do the coding please. I know this is not for free.
Fabius
Coding for what version?
Everything here on forums is free, unless you need private personal assistance? In this case, please use the programming services form: http://www.prorealcode.com/trading-programming-services/
So you only need to colour one candlestick? The 5th above or below the 20WMA? All over candlesticks remain of the default colour?
Here is the code corresponding to your request, I’m colouring candlesticks in yellow, you can change this colour with RGB format at lines 18 and 21.
Please consider that only close are tested above and below the 20 WMA (for the 5th candle count), not if the candlesticks are bearish or bullish.
if barindex>1 then
haclose=(open+close+low+high)/4
haopen=(haopen[1]+haclose[1])/2
xHigh = Max(haOpen, haClose)
xLow = Min(haOpen, haClose)
hahigh = Max(High,xHigh)
halow = Min(Low,xLow)
endif
avg = weightedaverage[20](close)
if haclose crosses over avg then
trend = 1
elsif haclose crosses under avg then
trend = -1
endif
if trend = 1 and summation[5](haclose>avg)=5 then
drawcandle(haopen,hahigh,halow,haclose)coloured(255,255,0)
trend = 0
elsif trend = -1 and summation[5](haclose<avg)=5 then
drawcandle(haopen,hahigh,halow,haclose)coloured(255,255,0)
trend = 0
endif
return
211Participant
Senior
Hi Nicolas,
Thank you so much for the coding, it works perfectly!!
Again many thanks,
Fabius