PDA

View Full Version : How to find Candle high of a currency pair



nhasan
07-22-2013, 08:24 AM
Hi Dear

This code should display candle high of EUR/USD for today and yesterday -

Dim Highs as Object
Dim pSymbol as VTLGeneral.cSymbol
Dim pDay as Integer = VTLGeneral.ENUM_PERIOD.DAY
Dim vHigh as Integer = VTLGeneral.ENUM_HISTORY_TYPE.HIS_HIGH

pSymbol = ClientCode.GetSymbolByName( "EUR/USD" )
Highs = ClientCode.GetChartHistory ( pSymbol.ID, pDay, vHigh, 3 )

GUI.MsgDialog("High Today:" & Highs(2) & " High Last Day: " & Highs(1))

It shows wrong value.
Message shows High Today: 1.261500 High Last Day: 1.265050
But I can see from price chart that high of today(22 July) candle is 1.31690 and last day(19 July) : 1.31500

Is there anything wrong in my code?

Salah-HS
07-22-2013, 10:19 AM
Dear,
You can get the High of the yesterday using the following :




Public Sub main()
'''TODO: Script program start method
Dim Highs as Object
Dim pSymbol as VTLGeneral.cSymbol
Dim pDay as Integer = VTLGeneral.ENUM_PERIOD.DAY
Dim vHigh as Integer = VTLGeneral.ENUM_HISTORY_TYPE.HIS_HIGH

pSymbol = ClientCode.GetSymbolByName( "EUR/USD" )
Highs = ClientCode.GetChartHistory ( pSymbol.ID,pDay,VTLGeneral.ENUM_HISTORY_TYPE.HIS_H IGH,ClientCode.Bars(pSymbol.ID,7) )

GUI.MsgDialog(" High Last Day: " & Highs(Ubound(Highs)-1))

End Sub



And this way is not applicable for getting the high of current day since that value will not be stored in the database before the ending of the day.
So you can go on a for loop and loop over all the record of the current day as they are of type MINUTE ONE to get the highest high of them.

nhasan
07-23-2013, 04:53 AM
Thanks
It's working

b_morar
07-23-2013, 10:38 AM
You are welcome
let me know if you need further assistance