Market Watch
Posted by Yousef Ibrahim, Last modified by Laith Ghawi on 08 July 2019 11:43 AM

Script

'''#####################################################################################
'''####     Script Name: Market Watch                                             ######
'''####     Author     : Salah Abu-Ghalyon                                        ######
'''####     Website    : www.Hybrid-solutions.com                                 ######
'''####     Date       : 20/06/2013 4:35:47                                       ######
'''####     Description:This code shows The Market watch on a created form        ######
'''#####################################################################################

Sample

Dim _vSymbol as VTLGeneral.CSymbol

Dim lst as VTLGeneral.VTLControls.VTLListView
Dim itemvalues as New System.Collections.Generic.List(Of VTLGeneral.VTLControls.ListViewItem)

Public Sub main()

Dim colvalue as VTLGeneral.VTLControls.ListViewcolumn
Dim itemvalue as VTLGeneral.VTLControls.ListViewItem
Dim colvalues as New System.Collections.Generic.List(Of VTLGeneral.VTLControls.ListViewcolumn)

Dim frm as New VTLGeneral.VTLForm("frm1") 
Dim listOfcolumns as New VTLGeneral.VTLControls.ListViewcolumns
Dim _index as integer

lst= New VTLGeneral.VTLControls.VTLListView("lst1") 
frm.AddVTLControl(lst)

frm.Height="7000 "
frm.Width="8000"
frm.show()

lst.Height="15000"
lst.Width="15000"
lst.Top="1000"
lst.left="500"
lst.FontItalic=True

colvalue= New VTLGeneral.VTLControls.ListViewcolumn
colvalue.Text="Symbol Name"
colvalue.Key="SymbolName"
colvalue.Index=cstr(1)
colvalues.Add(colvalue)

colvalue= New VTLGeneral.VTLControls.ListViewcolumn
colvalue.Text="Bid"
colvalue.Key="Bid"
colvalue.Index=cstr(2)
colvalues.Add(colvalue)

colvalue= New VTLGeneral.VTLControls.ListViewcolumn
colvalue.Text="ASk"
colvalue.Key="ASk"
colvalue.Index=cstr(3)
colvalues.Add(colvalue)

colvalue= New VTLGeneral.VTLControls.ListViewcolumn
colvalue.Text="High"
colvalue.Key="High"
colvalue.Index=cstr(4)
colvalues.Add(colvalue)

colvalue= New VTLGeneral.VTLControls.ListViewcolumn
colvalue.Text="Low"
colvalue.Key="Low"
colvalue.Index=cstr(5)
colvalues.Add(colvalue)

lst.AddHeader(colvalues)
colvalues.clear()

Dim i As Integer
For i = 1 To ClientCode.SymbolsCount
_vSymbol = ClientCode.GetSymbolByIndex(i)
If Not _vSymbol Is Nothing Then
_index=_index+1

itemvalue= New VTLGeneral.VTLControls.ListViewItem
itemvalue.Text=_vSymbol.Name
itemvalue.Key="S" & _vSymbol.Name
itemvalue.Index=CSTR(_index)

itemvalue.AddSubItem(_vSymbol.Bid)
itemvalue.AddSubItem(_vSymbol.Ask)
itemvalue.AddSubItem(_vSymbol.High)
itemvalue.AddSubItem(_vSymbol.Low)

itemvalues.Add(itemvalue)

End If

Next
lst.AddListItem(itemvalues)

End Sub

Public Sub OnTick()
Dim i As Integer
For i = 1 To ClientCode.SymbolsCount
     _vSymbol = ClientCode.GetSymbolByIndex(i)

If Not _vSymbol Is Nothing Then
      SymbolChanged(_vSymbol)
End If

Next

End Sub

Public Sub SymbolChanged(ByVal symbol As VTLGeneral.CSymbol)

Dim listSubItemValues as New System.Collections.Generic.List(Of VTLGeneral.VTLControls.SubItem)
Dim SubItemValue as VTLGeneral.VTLControls.SubItem

SubItemValue= New VTLGeneral.VTLControls.SubItem
SubItemValue.Index=1
SubItemValue.Text=symbol.Bid

listSubItemValues.Add(SubItemValue )

SubItemValue= New VTLGeneral.VTLControls.SubItem
SubItemValue.Index=2
SubItemValue.Text=symbol.Ask

listSubItemValues.Add(SubItemValue )

lst.UpdateSubItem("S" & symbol.Name,listSubItemValues)

End Sub​


See Also


Back to VTL Server Script Index

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