AddCustomIndicator
Posted by Mohammad Rahhal, Last modified by Diana Alkouni on 07 September 2020 12:55 PM

Syntax

Public Function AddCustomIndicator(chart_ID As Long, bufferAry As Variant, startPos As Integer, subWindow As Boolean, Optional win As Long = 0 ,Optional Indicator As String  = “Custom Indicator”)As String

Description

This function is used to add an indicator to the specified chart by a given the buffer array and chart index.

Parameters

Key Description 
chart_ID Chart identifier, 0 is the current chart, a value of type Long
bufferAry The indicator input array to be drawn.
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 int he 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 , a value of type String.

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() to read the error.

Sample

Dim indKey

Dim vchartId

Dim vchartName

Dim resultValue

Public Sub Main()

Dim highArry()

vchartId=chartId

  vchartName=ChartSymbol(Clng(vchartId))

  CopyHigh 0,1, bars(0),highArry

  indKey=AddCustomIndicator(0, highArry,1,False,0,"Indicator")

End Sub

Public Sub OnTick(SymbolName)

if symbolName = ChartSymbol(0) then
   ObjectSeriesSetValue 0,CSTR(indKey),CLNG(bars(0)),CDBL(GetHigh(0,bars(0)))
end if

End Sub

Public Sub OnCalculate(symbol ,symPeriod, openVal , highVal , lowVal , closeVal )

SetIndicatorData 0,CSTR(indKey),CDbl(highVal)

End Sub

 


See Also


Back to VTL Client Script Index

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
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