PDA

View Full Version : How to write on chart?



abdulaziz
07-01-2015, 06:41 AM
sir,
kindly go thru the code pasted below

Public sub OnTick(SymbolName)


if not SymbolInfoDouble( CSTR(SymbolName) ,2,askValue) then
MsgBox ErrorDescription(GetLastError())
End if


'SetPricelabel 0,CSTR(objID),PRICE_LABEL_POSITION,CDbl(askValue)
if SymbolName = "ZINC JULY-N" or SymbolName = "LEAD JULY-N" Then
if SymbolName = "ZINC JULY-N" Then
pricea = askValue
elseif SymbolName = "LEAD JULY-N" Then
priceb = askValue
end if


msgbox pricea-priceb
end if
End Sub

In the code above i am displaying the result of 'pricea - priceb' in MsgBox. instead of MsgBox how to display it on chart window ?
i tried many ways and failed. Could you please privide me the code to solve the problem.
I am so thankful to you.

Rawan-HS
07-01-2015, 07:15 AM
Dear abdulaziz ,

We have in VTL CreateObjectLabe (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2343)l method that create Label which appeared according to position you defined on the chart ,

try this code and let me know if you need any things




Public sub OnTick(SymbolName)


if not SymbolInfoDouble( CSTR(SymbolName) ,2,askValue) then
MsgBox ErrorDescription(GetLastError())
End if




'SetPricelabel 0,CSTR(objID),PRICE_LABEL_POSITION,CDbl(askValue)
if SymbolName = "ZINC JULY-N" or SymbolName = "LEAD JULY-N" Then
if SymbolName = "ZINC JULY-N" Then
pricea = askValue
CreateObjectLabel 0,0,"pricea",50,50,CSTR(pricea)
elseif SymbolName = "LEAD JULY-N" Then
priceb = askValue
CreateObjectLabel 0,0,"priceb",50,50,CSTR(priceb)
end if


end if
End Sub