Knowledgebase:
Custom Indicator
Posted by Yousef Ibrahim, Last modified by Hassan Abu Krayem on 19 August 2014 04:46 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.hybrid-solutions.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