Knowledgebase
Custom Indicator
Posted by Yousef Ibrahim on 25 March 2012 05:17 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,0)

End Sub

Public Sub OnTick(SymbolName)

ObjectSeriesGetValue 0,cstr(vchartName & ".close"),CLNG(bars(CLNG(vchartId))),resultValue

ObjectSeriesSetValue 0,CSTR(indKey),CLNG(bars(CLNG(vchartId))),CDBL(resultValue)

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

(0 votes)
This article was helpful
This article was 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. This is required to prevent automated registrations and form submissions.

Help Desk Software by Hybrid Solutions