PDA

View Full Version : MQL to VTL conversion -- Similar Functions needed



mayankj990@gmail.com
01-25-2014, 07:47 AM
Hi Sir,
I am converting MQL script to VTL Script. I wonder if any one can tell me similar VTL functions..?

1. MarketInfo(Symbol(),MODE_DIGITS)

2. IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS))

3. iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, TradePeriod,i+1)); ........// i =0 to n

4. iATR(Symbol(), 0, ATRPeriod, i) ........// i =0 to n

5. SetIndexStyle(0,DRAW_ARROW) SetIndexArrow(0, 233)

6. SetIndexLabel(0,"Buy breakout "+ TradePeriod)

7.'//---- indicator buffers
double ExtMapBuffer1[];
SetIndexBuffer(0,ExtMapBuffer1);

Hassan-HS
01-25-2014, 10:25 AM
Dear,



1. MarketInfo(Symbol(),MODE_DIGITS)

You should use SymbolInfoInteger (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1733)

sample:



Public Sub main()
Dim x
SymbolInfoInteger "EUR/USD",SYMBOL_PIP_LOCATION,x
MsgBox Abs(x )

End Sub




2. IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS))
It's sets precision format (the count of digits after decimal point) to visualize indicator values, so you can use Round function before set indicator values... Round ( expression, [decimal_places] ).


3. iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, TradePeriod,i+1)); ........// i =0 to n


IHigh (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/4022) this function returns the high value for the specific bar.


4. iATR(Symbol(), 0, ATRPeriod, i) ........// i =0 to n

you can use this AverageTrueRangeOnArray (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3473), this procedure calculate The Average True Range, based on custom array.



5. SetIndexStyle(0,DRAW_ARROW) SetIndexArrow(0, 233)



SetDrawingStyle (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3451) this function sets drawing style for a given indicator line.


6. SetIndexLabel(0,"Buy breakout "+ TradePeriod)

Ignore it, there is no need to this function in VTL, you need to declare an array after that pass it to AddCustomIndicator (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2662).




7.'//---- indicator buffers
SetIndexBuffer(0,ExtMapBuffer1);

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


Sample for custom indicator




Dim indKey

Dim vchartId

Dim vchartName

Dim resultValue

Public Sub Main()

Dim highArry()

vchartId=chartId

vchartName=ChartSymbol(Clng(vchartId))

CopyHigh 0,1, bars(0),highArry

indKey=AddCustomIndicator(0, highArry,1,False)

End Sub

Public Sub OnTick(SymbolName)

ObjectSeriesGetValue 0,cstr(vchartName & ".High"),CLNG(bars(CLNG(vchartId))),resultValue

ObjectSeriesSetValue 0,CSTR(indKey),CLNG(bars(CLNG(vchartId))),CDBL(res ultValue)

End Sub

Public Sub OnCalculate(symbol ,symPeriod, openVal , highVal , lowVal , closeVal )

SetIndicatorData 0,CSTR(indKey),CDbl(highVal)

End Sub

mayankj990@gmail.com
01-27-2014, 04:56 PM
Dear !
For Function 3
iHigh(Symbol(),Period(),iHighest(Symbol(), Period(), MODE_HIGH, TradePeriod,i+1));
how to get 3rd parameter shift. Here they used iHighest( ) to get the 3rd parameter 'shift'

Hassan-HS
01-27-2014, 05:23 PM
Hello,,,


You can pass the high array to ArrayMaximum (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1698)

Edakad
06-17-2014, 06:25 PM
Hello

What is the equivalent of this mq4 line


SetIndexStyle(0,DRAW_SECTION);

Edakad
06-18-2014, 07:31 AM
Hello

What is the equivalent of this mq4 line


SetIndexStyle(0,DRAW_SECTION);

Just bumping this post

Hassan-HS
06-18-2014, 07:35 AM
Hello,

We have the following styles only, DRAW_LINE,DRAW_DOTS,DRAW_ARROWS,DRAW_ZIGZAG, however we will study the possibility of adding DRAW_SECTION.

Edakad
06-18-2014, 12:37 PM
Can you explain a little more on style DRAW_ZIGZAG_E

Hoe do the values for zigzag are set in buffer array ?

suppose I have an array with values test(2,0,0,0,0,0,5,0,0). Is selecting ZIGZAG style will draw zigzag line from 2 to 5 ignoring the 0 values ?

Thanking you for your timely help always

Hassan-HS
06-18-2014, 04:31 PM
Hello,



No, it's ignore dtNull Value (-987654321).