Help with coding candlesticks color please!
Forums › ProRealTime English forum › ProBuilder support › Help with coding candlesticks color please!
- This topic has 8 replies, 2 voices, and was last updated 7 years ago by 211.
-
-
12/10/2016 at 4:55 PM #18213
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
12/12/2016 at 9:20 AM #18281This 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.
12/12/2016 at 11:40 AM #1830912/12/2016 at 12:03 PM #18312Coding 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/
12/12/2016 at 12:06 PM #1831312/12/2016 at 1:20 PM #1833312/12/2016 at 1:22 PM #1833412/12/2016 at 3:53 PM #18346Here 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.
12345678910111213141516171819202122232425if barindex>1 thenhaclose=(open+close+low+high)/4haopen=(haopen[1]+haclose[1])/2xHigh = Max(haOpen, haClose)xLow = Min(haOpen, haClose)hahigh = Max(High,xHigh)halow = Min(Low,xLow)endifavg = weightedaverage[20](close)if haclose crosses over avg thentrend = 1elsif haclose crosses under avg thentrend = -1endifif trend = 1 and summation[5](haclose>avg)=5 thendrawcandle(haopen,hahigh,halow,haclose)coloured(255,255,0)trend = 0elsif trend = -1 and summation[5](haclose<avg)=5 thendrawcandle(haopen,hahigh,halow,haclose)coloured(255,255,0)trend = 0endifreturn12/12/2016 at 4:00 PM #18350 -
AuthorPosts
Find exclusive trading pro-tools on