Nicolas

Daily candlestick on any timeframe chart

Category: Indicators By: Nicolas Created: May 25, 2016, 10:15 PM
May 25, 2016, 10:15 PM
Indicators
6 Comments
Daily candlestick on any timeframe chart

This indicator draw the actual daily candlestick on any timeframe. You can change the visibility of the candlestick with the “alpha” variable set from 0 to 255 which change the transparency of it. It is not possible to draw objects on the right of the chart, so the candle is displayed overlayed of the price.

The candlestick is made of rectangles drawn with the new graphical objects of the 10.3 version of the platform.

defparam drawonlastbaronly = true

alpha = 255 //from 0 to 255 to change alpha transparency

dop = dopen(0)
dhi = dhigh(0)
dlo = dlow(0)
dcl = dclose(0)

//candlestick color
if dop>dcl then
direction = -1
else
direction = 1
endif

//bullish candle
if direction = 1 then
 //candlestick body
 DRAWRECTANGLE(barindex-5,dop,barindex,dcl) COLOURED(10,255,10,alpha)
 //candlestick high and low
 DRAWRECTANGLE(barindex-3,dcl,barindex-2,dhi) COLOURED(10,255,10,alpha)
 DRAWRECTANGLE(barindex-3,dop,barindex-2,dlo) COLOURED(10,255,10,alpha)
endif

//bearish candle
if direction = -1 then
 //candlestick body
 DRAWRECTANGLE(barindex-5,dcl,barindex,dop) COLOURED(255,10,10,alpha)
 //candlestick high and low
 DRAWRECTANGLE(barindex-3,dop,barindex-2,dhi) COLOURED(255,10,10,alpha)
 DRAWRECTANGLE(barindex-3,dcl,barindex-2,dlo) COLOURED(255,10,10,alpha)
endif

RETURN

Download
Filename: Daily-Candlestick.itf
Downloads: 191
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

M.Nicolas 81
6 years ago
#

Hola Nicolas. ¿Existe la posibilidad de que este indicador se muestre también en el histórico anterior ?

Nicolas
6 years ago
#

That would be possible to be coded using MTF indicator in PRT v11.

Pere
8 years ago
#

This is the code changed to draw the last 2 days: defparam drawonlastbaronly = true alpha = 255 //from 0 to 255 to change alpha transparency dop = dopen(0) dhi = dhigh(0) dlo = dlow(0) dcl = dclose(0) //Candle yesterday dopy = dopen(1) dhiy = dhigh(1) dloy = dlow(1) dcly = dclose(1) //candlestick color if dop>dcl then direction = -1 else direction = 1 endif if dopy>dcly then directiony = -1 else directiony = 1 endif //bullish candle if direction = 1 then //candlestick body DRAWRECTANGLE(barindex-7,dop,barindex-2,dcl) COLOURED(10,205,10,alpha)//Originalmente verde 10,255,10 //candlestick high and low DRAWRECTANGLE(barindex-5,dcl,barindex-4,dhi) COLOURED(10,205,10,alpha) DRAWRECTANGLE(barindex-5,dop,barindex-4,dlo) COLOURED(10,205,10,alpha) endif //bearish candle if direction = -1 then //candlestick body DRAWRECTANGLE(barindex-7,dcl,barindex-2,dop) COLOURED(255,10,10,alpha) //candlestick high and low DRAWRECTANGLE(barindex-5,dop,barindex-4,dhi) COLOURED(255,10,10,alpha) DRAWRECTANGLE(barindex-5,dcl,barindex-4,dlo) COLOURED(255,10,10,alpha) endif //bullish candle yesterday if directiony = 1 then //candlestick body DRAWRECTANGLE(barindex-15,dopy,barindex-10,dcly) COLOURED(10,205,10,alpha) //candlestick high and low DRAWRECTANGLE(barindex-13,dcly,barindex-12,dhiy) COLOURED(10,205,10,alpha) DRAWRECTANGLE(barindex-13,dopy,barindex-12,dloy) COLOURED(10,205,10,alpha) endif //bearish candle yesterday if directiony = -1 then //candlestick body DRAWRECTANGLE(barindex-15,dcly,barindex-10,dopy) COLOURED(255,10,10,alpha) //candlestick high and low DRAWRECTANGLE(barindex-13,dopy,barindex-12,dhiy) COLOURED(255,10,10,alpha) DRAWRECTANGLE(barindex-13,dcly,barindex-12,dloy) COLOURED(255,10,10,alpha) endif RETURN

Nicolas
8 years ago
#

Thank you Pere!

supertiti
10 years ago
#

désolé , j'ai compris ! alpha dans le code ou en variable !!

supertiti
10 years ago
#

Bonjour Nicolas

J'ai mis alpha en variable pour jouer sur la transparence car je ne vois pas comment on peut faire? pour autant la transparence ne bouge pas entre 0 et 255 ! j'ai loupé quelque chose ?

merci

bonne journée à tous

 

ProRealCode ProRealCode
Loading...