Posted by Mohammad Rahhal, Last modified by Diana Alkouni on 21 August 2020 01:29 PM


Public function AddCustomIndicatorCandles( chart_index as integer , ArrOpen as variant , arrHigh as variant , arrLow as variant , arrClose as variant , startPos as integer , optional subwindow as Boolean = true , optional win as long = 0 ,opional indicator as string = "Custom Indicator" , optional UpCandle as OLE_COLOR = -123 , optional DownCAndleColor as OLE_COLOR = -123 ,optional SeriesColor as OLE_COLOR = -123 ) as string

This function is used to add an indicator to the specified chart by giving it 4 buffers arrays and draw them as a candles.


Parameters Description 
chart_index Chart position on the chart windows, 0 means the current chart, value of type integer
ArrOpen The open prices array to be drawn. Value of type Variant.
arrHigh The High prices array to be drawn. Value of type Variant.
arrLow The Low prices array to be drawn. Value of type Variant.
arrClose The close prices array to be drawn. Value of type Variant.
startPos Start position to draw a custom indicator, value of type Integer.
Subwindow Indicates to drawing a custom indicator in separate panel .if the value true, the indicator will be in separate panel, otherwise, it will be in the same panel (current panel).
Win Panel (Sub window) Number.To Get the panel Number base on the series name, you can call GetSubWindow(). Value of type Long.
Indicator Indicator name on data window, if the value not set, the name will appear as Customs indicator, value of type String.
UpCandle color of the UP candles (close price less than high price)
DownCAndleColor color of the down candles(high price less than close price)
SeriesColor The color of the candle which Is not up or down.

Return value

Returns the indicator name as a value of a string. If the function fails, the returned value will be an empty string, otherwise it will be a string value. To get the detailed error information, one has to call GetLastError().


Dim indKey

Dim vchartId

Dim vchartName

Dim resultValue

Public Sub Main()

    Dim OpenArry()

    Dim highArry()

    Dim LowArry()

    Dim CloseArry()



      CopyOpen 0,1, bars(0),OpenArry

      CopyHigh 0,1, bars(0),highArry

      CopyLow 0,1, bars(0),LowArry

      CopyClose 0,1, bars(0),CloseArry

     indKey=AddCustomIndicatorCandles(0, openArry , highArry,lowArray ,  closeArry ,1,False,0,"Indicator",VbRed,VbBlue)

End Sub

See Also

Back to VTL Client Script Index

(0 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions