Login
Try VertexFX
  • Home
  • Knowledgebase
  • Blog
  • Forum
  • Home
  • Knowledgebase
  • Blog
  • Forum

General Indicators

home/Knowledge Base/Technical Support/API/Client API's/VTL/VTL Server Scripts/Technical Analysis (TA)/General Indicators/Correlation Analysis

Correlation Analysis

0 views 0 December 16, 2021 hybrid-solutions

Syntax

Public function CorrelationAnalysis(ByRef Source1 As Field, ByRef Source2 As Field) As Double

Overview

Correlation analysis is used to show the relationship between two different securities or indicators.

Note

The CorrelationAnalysis function returns a double value indicating the relationship between two Field objects.

The Field objects may contain price, indicator or other values.

Class: General

Parameters

Return Type Double that indicate the relationship between two Field.
Default Field Name(s) EnvelopeTop, EnvelopeBottom.


Sample

Public Sub main()        'Variables        Dim _symbolInfo As VTLGeneral.CSymbol=ClientCode.GetSymbolByName("GOLD")        Dim DB As New VTLGeneral.Database()        Dim rsOHLCV As New VTLGeneral.RecordSet()        Dim RecordCount As Integer        Dim m_Recordset As VTLGeneral.RecordSet        Dim _historyData As object()        Dim output As String        Dim Record As Integer        Dim m_High As VTLGeneral.Field        Dim m_Low As VTLGeneral.Field        Dim m_Open As VTLGeneral.Field        Dim m_Close As VTLGeneral.Field        Dim j As Integer = 0        Dim i As Integer = 0        Dim _recordCount As Integer =100                m_Recordset = DB.CreateRecord        m_Open = New VTLGeneral.Field        m_High = New VTLGeneral.Field        m_Low = New VTLGeneral.Field        m_Close = New VTLGeneral.Field         m_Recordset = DB.CreateRecord         m_High = New VTLGeneral.Field        m_Close = New VTLGeneral.Field         DB.RecordCount = _recordCount        RecordCount = _recordCount         'Initialize Recordsets        m_High.initialize(_recordCount, "High")        m_Close.initialize(_recordCount, "Close")         'load high, low ,open and data         _historyData = ClientCode.GetChartHistory(_symbolInfo.ID, VTLGeneral.ENUM_PERIOD.Day,VTLGeneral.ENUM_HISTORY_TYPE.HIS_HIGH, _recordCount)          For i  = 1 To _recordCount-1                m_High.setValue(i,_historyData(i))         Next        _historyData = ClientCode.GetChartHistory(_symbolInfo.ID, VTLGeneral.ENUM_PERIOD.Day,VTLGeneral.ENUM_HISTORY_TYPE.HIS_CLOSE, _recordCount)         For i  = 1 To _recordCount-1                m_Close.setValue(i,_historyData(i))        Next          m_Recordset.addField(m_High)        m_Recordset.addField(m_Close)        Dim gnl As New VTLGeneral.General( )         GUI.MsgDialog( gnl.CorrelationAnalysis(m_High,m_Close)) End Sub  

See Also

  • Median Price
  • Price Rate of Change
  • Standard Deviations


Back to VTL Server Script Index

Was this helpful?

Yes  No
Leave A Comment Cancel reply

About
VertexFX Trader has a closed-loop trading structure with Backoffice dealing desk, Client Terminals, Dedicated Hosting, White Labelling and Bridging Capabilities. Through VertexFX Risk Management Bridge...
Categories
  • Technical Support
  • Social Trading
  • VertexFX Pro Setup
  • Mobile Trader
  • Lite VertexFX Mobile Trader
Community
  • Blog
  • Forum
  • Media Center
Need Support?
If you need any further help, don't hesitate to send a support request to our support team.
Contact Support
  • Privacy Policy
  • Brokers Terms
  • Traders EULA
  • ISV Terms
  • Plugins EULA
  • Copyright 2022 hybridsolutions.com. All Rights Reserved.