PDA

View Full Version : Similar VTL functions needed



soori1234
01-28-2014, 12:21 PM
Hi.. I am converting MQL Script to VTL script. I am facing problem in finding the similar VTL functions. Can anyone tell me similar VTL functions for below MQL functions

1. IndicatorCounted( );

2. Bars

3. int TradePeriod = 20
iHighest(Symbol( ), Period(), MODE_HIGH, TradePeriod,1)

Thank You..

Hassan-HS
01-28-2014, 12:40 PM
Dear Sir,




IndicatorCounted( )

Ignore It, there is no need to use this in VTL


Bars

Bars (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2656)

3. int TradePeriod = 20
iHighest(Symbol( ), Period(), MODE_HIGH, TradePeriod,1)

pass the array of values (high array in your case)to ArrayMaximum (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1698)and its will return the highest value that between two indexes (1st index - 20th index) in your case

soori1234
01-28-2014, 03:51 PM
Hi Sir,
For function
3. int TradePeriod = 20
iHighest(Symbol( ), Period(), MODE_HIGH, TradePeriod,1)

I have used below code. But it is not giving any result
Dim TradePeriod
TradePeriod = 20

Dim HighAry()

CopyClose 0, 1, Bars (0), HighAry

MsgBox = ArrayMaximum (HighAry(), 1 , TradePeriod)

Can you resolve this issue?
Thak You..

soori1234
01-28-2014, 04:06 PM
Hi
This is the complete row in MQL Script. Can you tell me the equivalent VTL

int TradePeriod = 20
double rhigh = iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, TradePeriod,i+1)); i = 1 to n...

Hassan-HS
01-28-2014, 06:19 PM
Hello Soori,

You can use this function....






Public Sub main()
''''TODO: Script program start method
Dim HighAry()
TradePeriod=20
CopyHigh 0, 1, Bars (0), HighAry

MsgBox Highest (HighAry, 1 ,Clng(TradePeriod))
End Sub



Public function Highest(Ary,Start,Count)
Dim High
If Start < Lbound(Ary) Or Count > UBound(Ary) Or Count+Start > UBound(Ary) then
MsgBox " Please Pass A Valid Parameters "
end if

High=Ary(Start)
For i = Start to Count
If High < Ary(i) then
High = Ary(i)
End IF
Next
Highest= High

End function