Custom Indicator
Posted by Yousef Ibrahim, Last modified by Diana Alkouni on 07 September 2020 01:35 PM

'###########################################################
' Script Name: Custom Indicator
' Author: Ehab Kanani
' Description: This Client Script will draw a custom indicator on the chart based on your values
' Website: http://www.hybridsolutions.com
' Date: March, 22nd, 2012
'###########################################################

Dim indKey

Dim vchartId

Dim vchartName 

Dim resultValue

Public Sub main ()

Dim highArry() 

vchartId=chartId 

vchartName=ChartSymbol(Clng(vchartId))

CopyHigh 0,1, bars(CLNG(vchartId)),highArry

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

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

''' <summary>
''' The function is generated when initialization script
''' </summary>

Public Sub OnInit()
'''TODO: initialization method

End Sub

''' <summary>
''' The function is generated when deinitialization script
''' </summary>

Public Sub OnDeInit()
'''TODO: deinitialization method

End Sub

''' <summary>
''' The OnTimer function called when the timer event occurs
''' </summary>

Public Sub OnTimer()
'''TODO: Timer Function
End Sub

See Also


Back to VTL Client Script Index

(1 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