PDA

View Full Version : I have a couple of doubts in VTL. Admin kindly help



NCD
06-21-2015, 04:41 PM
Questions for VTL support :


1) How to access the Volume of bar or the Volume series (array) in VTL code ?





2) How to draw two custom indicators in the same sub-window ? It tried the following code for
drawing High and Low series in new sub-window, but it creates two new sub-windows instead of one.
See sample code below - it should draw the High and Low in a new (same) sub-window, but
it draws them in different sub-windows.


' SAMPLE INDICATOR CODE TO DRAW HIGH and LOW prices in a new single sub-window.
' IT DOEST NOT WORK !!
' ----- CODE BEGINS HERE ------
Public Sub main()

' We fetch high and low in the arrHigh and arrLow arrays
Dim arrHigh(), arrLow()
CopyHigh 0, 1, Bars(0), arrHigh
CopyLow 0, 1, Bars(0), arrLow


Dim ind1, ind2, subWindowID


' We draw first series as arrHigh array
' in a new sub-window
ind1 = AddCustomIndicator(0, arrHigh, 1, True)
SetSeriesStyle 0, CStr(ind1), LINE_CHART
LineColor 0, CStr(ind1), RGBColor(255, 0, 0)


' We now find the sub-window of the first indicator.
subWindowID = CLng(GetSubwindow(0, CStr(ind1)))


' We now draw the second series as arrLow array
' in the previously created sub-window.


ind2 = AddCustomIndicator(0, arrLow, 1, True, CLng(subWindowID))
SetSeriesStyle 0, CStr(ind2), LINE_CHART
LineColor 0, CStr(ind2), RGBColor(0, 0, 255)


End Sub


'----- CODE ENDS HERE -----


:confused::confused::confused:

Hassan-HS
06-22-2015, 09:36 AM
Hi NCD,

Unfortunately it's not available in the system right now, it well be included in the next version.

we've changed this line to be

ind2 = AddCustomIndicator(0, arrLow, 1, false, CLng(subWindowID))
instead of

ind2 = AddCustomIndicator(0, arrLow, 1, true, CLng(subWindowID))


Public Sub main()


' We fetch high and low in the arrHigh and arrLow arrays
Dim arrHigh(), arrLow()
CopyHigh 0, 1, Bars(0), arrHigh
CopyLow 0, 1, Bars(0), arrLow




Dim ind1, ind2, subWindowID




' We draw first series as arrHigh array
' in a new sub-window
ind1 = AddCustomIndicator(0, arrHigh, 1, True)
SetSeriesStyle 0, CStr(ind1), LINE_CHART
LineColor 0, CStr(ind1), RGBColor(255, 0, 0)




' We now find the sub-window of the first indicator.
subWindowID = CLng(GetSubwindow(0, CStr(ind1)))




' We now draw the second series as arrLow array
' in the previously created sub-window.




ind2 = AddCustomIndicator(0, arrLow, 1, false, CLng(subWindowID))
SetSeriesStyle 0, CStr(ind2), LINE_CHART
LineColor 0, CStr(ind2), RGBColor(0, 0, 255)




End Sub