Draw custom OHLC barchart.
Syntax:
1 |
DRAWBARCHART(open,high,low,close) COLOURED(R,G,B) BORDERCOLOR(R,G,B) |
The open, high, low and close value can be set by any custom variables.
Coloured and Bordercolor instructions are optional, when not defined the colors will be the default price one.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
//Smooth Heiken Ashi barchart period = 20 if barindex>period then avgO = average[period](open) avgH = average[period](high) avgL = average[period](low) avgC = average[period](close) HAClose = (avgO+avgH+avgL+avgC) /4 HAOpen = (HAOpen[1]+HAClose[1]) / 2 HAHigh = MAX(avgH,MAX(HAOpen,HAClose)) HALow = MIN(avgL,MIN(HAOpen,HAClose)) IF avgO <= avgC THEN // Green candlestick DRAWBARCHART(HAOpen,HAHigh,HALow,HAClose) COLOURED(0,255,0) ELSE // Red candlestick DRAWBARCHART(HAOpen,HAHigh,HALow,HAClose) COLOURED(255,0,0) ENDIF endif RETURN |