Results 1 to 7 of 7

Thread: VTL Functions

  1. #1
    AmitSharma
    Guest

    Post VTL Functions

    Hi Sir,

    I have convert following function in vtl. Please verify it.

    MQL Function:
    1.
    double MACD = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow,
    MACD_Signal, PRICE_CLOSE, MODE_MAIN, i);

    MACD_Data =CSTR(MACD(0,CINT(MACD_Fast), CINT(MACD_Slow),CINT(MACD_Signal)))

    BarsVal = Bars(0) - i
    MACDVALUE = ObjectSeriesGetValue(0, CSTR(MACD_Data), CLNG(BarsVal), MACDValRes)

    2. double MACD_Sig = iMACD(Symbol(), Period(), MACD_Fast, MACD_Slow,
    MACD_Signal, PRICE_CLOSE, MODE_SIGNAL, i);

    MACD_Data =CSTR(MACD(0,CINT(MACD_Fast), CINT(MACD_Slow),CINT(MACD_Signal)))

    BarsVal = Bars(0) - i
    MACDVALUE = ObjectSeriesGetValue(0, CSTR(MACD_Data), CLNG(BarsVal), MACDValRes)


    I have following doubt...

    How to use "PRICE_CLOSE" Enum and MODE_SIGNAL and i value in VTL?

    Thank you

  2. #2
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Post Macd

    Hello Amit,



    • You can send the close prices to this procedure which is calculate MACD based on your custom prices.
    • Also its return MODE_SIGNAL results values in byref function


    Sample:

    Code:
    Public Sub main()
    
            Dim HighAry ()
    
            Dim LowAry ()
    
            Dim OpenAry ()
    
            Dim CloseAry ()
    
            Dim result()
    
            Dim SignalPeriod
    
            Dim FastEMA
    
            Dim SlowEMA
    
            Dim Signal
    
            SignalPeriod = 9
    
            FastEMA = 12
    
            SlowEMA = 26
    
            CopyHigh 0, 1, Bars (0), HighAry
    
            CopyLow 0, 1, Bars (0), LowAry
    
            CopyOpen 0, 1, Bars (0), OpenAry
    
            CopyClose 0, 1, Bars (0), CloseAry
    
            MACDOnArray OpenAry, HighAry, LowAry, CloseAry, CInt (SignalPeriod), CInt (FastEMA), CInt (SlowEMA), Result, Signal
    
            MsgBox "The indicator value of the record 50 : " & Result(50)
    
     End Sub

  3. #3
    bharat.ecb
    Guest

    Post Base indicator line and Signal Line

    Hi Sir,

    How can i use these ENUM in vtl? Can you give me sample?

    MODE_MAIN 0 Base indicator line.
    MODE_SIGNAL 1 Signal line.

    Thank you

  4. #4
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Post Macd

    Hello,


    in vtl there is no need to use this enums cause the two results return to you..

    Public Sub MACDOnArray(ByVal OpenAry As Variant, ByVal HighAry As Variant, ByVal LowAry As Variant, ByVal CloseAry As Variant, ByVal SignalPeriod As Integer, ByVal FastEMA As Integer, ByVal SlowEMA As Integer, ByRef Result As Variant, ByRef Signal As Variant)

    Result: this array represent the base indicator line


    Signal : this array represent the signal line



    So using the previous sample you can print :


    Code:
      MsgBox "The indicator value of the record 50 : " & Result(50)
    OR

    Code:
      MsgBox "The signal value of the record 50 : " & Signal(50)

  5. #5
    bharat.ecb
    Guest

    Default

    Hi dear,

    1. here we are passing different array like high,low and close of array

    MACDOnArray OpenAry, HighAry, LowAry, CloseAry, CInt (SignalPeriod), CInt (FastEMA), CInt (SlowEMA), Result, Signal

    I want to just confirm one think

    I need Price_Close array value.

    so i need to send one array. I have to pass blank array for other value like HighArry and LowArry.

    Is it way correct to calculate value ?

    Thank you

  6. #6
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Default

    Hi,
    I will update you soon please standby....

  7. #7
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Default

    Hello,,,


    The 4 array sources is required to calculate the MACD, I think that you have to ask TA expert....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MQL to VTL conversion -- Similar Functions needed
    By mayankj990@gmail.com in forum VertexFX API/VTL Forum
    Replies: 8
    Last Post: 06-18-2014, 04:31 PM
  2. Similar VTL functions needed
    By soori1234 in forum VertexFX API/VTL Forum
    Replies: 4
    Last Post: 01-28-2014, 06:19 PM
  3. Please help to return value from functions in client script
    By nhasan in forum VertexFX API/VTL Forum
    Replies: 8
    Last Post: 01-09-2014, 09:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •