Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 46
  1. #16
    Administrator Hassan-HS's Avatar
    Join Date
    Jun 2013
    Posts
    795

    Post Vtl

    Hello,



    1. By "makes troubles" I meant that when I use your code, my period of chart is changing and I have to change it back. When I do it in cycle, it's blinking.

    You can open new chart as following


    Code:
    Public Sub main()
    
    ChartOpen "EUR/USD",PERIOD_M1
    MsgBox GetHigh(Cint(0),Bars(Clng(0))-1)
    
    End Sub

    2. if not NewLimitOrder (-1, CSTR(SymbolName(1,true)), CDbl(1.0), CDbl(1.4)) then
    MsgBox ErrorDescription(GetLastError())
    end if
    Check the first symbol that exist in the market-watch then pass a valid prices based on it.


    Also, if this code is running in OnTick, it says error on symbolName, cause of OnTick function.
    We used to do
    Dim name
    sub main()
    name = SymbolName(1,true)
    end sub

    and then use "name" variable in spite of "SymbolName(1,true)".
    Please rename the argument that exist in the header of the OnTick event to different name Ex:

    Code:
    Public Sub OnTick(Symbol)
    
    End Sub

  2. #17
    diannt
    Guest

    Default

    h.abukrayem, thanks for answers.

    1. Would you like the program which is opening new charts, when it just need to get iHigh and iLow?

    2. We made orders like this:

    eps = 0.0050
    SymbolInfoDouble CStr(named),SYMBOL_ASK,asd

    if not NewLimitOrder (-1, CSTR(SymbolName(1,true)), CDbl(asd - eps)) then
    MsgBox ErrorDescription(GetLastError())
    end if

    And it does'nt work. With ANY eps.
    It also does'nt work with eps < 0.
    It also does'nt work, if we use it with any TP and SL.

    We don't know how to fix it.

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

    Post Vtl

    Hello
    1. Would you like the program which is opening new charts, when it just need to get iHigh and iLow?

    we will study this issue to develop it.



    eps = 0.0050
    You need to increase eps value.

  4. #19
    diannt
    Guest

    Default

    We tried this with many, many values without any result.

    Higher and lower then current.

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

    Default

    Dear,

    I will send you a sample when the market is opened.

  6. #21
    diannt
    Guest

    Default

    Thank you, h.abukrayem, I'm really waiting for it.

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

    Post NewLimitOrder

    Hello,

    this code take new limit order for EUR/USD.

    Code:
    Public Sub main()
    
      Dim OpenPrice
      Dim Offset
      SymbolInfoDouble "EUR/USD",SYMBOL_ASK,OpenPrice
      Offset=0.1
      OpenPrice=OpenPrice-0.1
    
       NewLimitOrder(TRADE_ACTION_BUY,"EUR/USD",1,Cdbl(OpenPrice),Cdbl(OpenPrice)-Cdbl(Offset),Cdbl(OpenPrice)+Cdbl(Offset)
    
     End Sub
    
    Public Sub OnOrderTrade(actionType ,orderID , returnValue)
    
    MsgBox "Result: " & Cbool(returnValue)
    
    End Sub

  8. #23
    diannt
    Guest

    Default

    Thank you very much.

    Now I want to know again - what do I have to do, if I need many candles in chart to test?
    It have around 2500 candles maximum, if I'm running left and left by mouse sliding.

    And if I have'nt done it - I got around 350 candles!

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

    Post

    Welcome


    You can load all chart candles by pressing"F5" or click over it is icon in the Charts Toolbar.

  10. #25
    diannt
    Guest

    Default

    Can I load all chart candles in VTL code?

    Also, there is one serious problem. I got only 2000 candles right now by pressiing F5.
    By "what do I have to do to get MORE" I meant, that I need more, then 2000...

    Around 50000 would be nice.
    Last edited by diannt; 10-16-2013 at 10:14 AM.

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

    Post

    Can I load all chart candles in VTL code?
    No you cant.


    Also, there is one serious problem. I got only 2000 candles right now by pressing F5.
    By "what do I have to do to get MORE" I meant, that I need more, then 2000...
    That is depends on custom configuration that is set by the owner of the system.

  12. #27
    diannt
    Guest

    Default

    Hello again!

    I got an awesome error.
    When I open my expert first time I'm getting "[VTL Exception][Method Name:StringSubStr]: Invalid procedure call or argument" error, that prints 5 times before expert loads.
    Then expert types that it's loaded succefully.

    Then I can off expert and load it again. And there is will no errors typed anymore.

    What's wrong?

    I'm using StringSubStr in code like this:

    z = StringSubstr(CStr(x), CInt(y+6))
    and this

    m = StringSubstr(CStr(z),CInt(f+1),CInt(2))

    Also, I'm doing it more then 5 times in code.

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

    Default

    Welcome,

    Please send me your code, let me check it.

  14. #29
    diannt
    Guest

    Default

    I'm using StringSubStr function in this code:

    Public Function Digits()
    Dim bik, f, t
    SymbolInfoDouble CStr(named), SYMBOL_BID, bik
    f = StringFind(CStr(bik), ".", 1)
    t = StringSubstr(CStr(bik), CInt(f))
    Digits = CInt(StringConcatenate(CStr(t), ""))
    Exit Function
    End Function

    Public Function Timering(x)
    Dim y, z, h, m, t, f
    y = StringFind(CStr(x), "/", 4)
    if y>0 then
    z = StringSubstr(CStr(x), CInt(y+6))
    else
    z = x
    end if
    h = StringSubstr(CStr(z),CInt(1),CInt(2))
    f = StringFind(CStr(z), ":", 1)
    m = StringSubstr(CStr(z),CInt(f+1),CInt(2))
    t = CInt(h)*100 + CInt(m)
    Timering = CInt(t)
    Exit Function
    End Function

    Public Function GetDayHigh(shift)
    Dim time
    Dim y, z, h, m, t, f
    time = CurTime()
    y = StringFind(CStr(time), "/", 4)
    z = StringSubstr(CStr(time), CInt(y+6))
    h = StringSubstr(CStr(z),CInt(1),CInt(2))
    f = StringFind(CStr(z), ":", 1)
    m = StringSubstr(CStr(z),CInt(f+1),CInt(2))
    Dim u
    Select Case ChartPeriod() 'Select Period
    Case 1
    u = 1000
    t = CInt(CInt(h)*60 + CInt(m) + shift*CInt(u))
    Case 2
    u = 288
    t = CInt((CInt(h)*60 + CInt(m))/5) + CInt(shift*u)
    Case 3
    u = 96
    t = CInt((CInt(h)*60 + CInt(m))/15) + CInt(shift*u)
    Case 4
    u = 48
    t = CInt((CInt(h)*60 + CInt(m))/30) + CInt(shift*u)
    Case 5
    u = 24
    t = CInt((CInt(h)*60 + CInt(m))/60) + CInt(shift*u)
    Case 6
    u = 6
    t = CInt((CInt(h)*60 + CInt(m))/240) + CInt(shift*u)
    Case 7
    u = 1
    t=shift+u
    Case 8
    MsgBox "Too big period"
    Case 9
    MsgBox "Too big period"
    Case Else
    End Select
    Dim highArray
    CopyHigh 0,CInt(Bars(0)) - CInt(t),CInt(u),highArray
    dim max
    max = CDbl(ArrayMax (highArray))
    GetDayHigh = CDbl(max)
    Exit Function
    End Function

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

    Default

    Hello,

    there is no issue in this part of the code, can you send me the full script? any way please check that you are already assigned a value to variables before using it.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Convert from MQL to VTL
    By Snake in forum VertexFX API/VTL Forum
    Replies: 19
    Last Post: 04-21-2014, 03:02 PM
  2. Converting MQL to VTL
    By Snake in forum VertexFX API/VTL Forum
    Replies: 5
    Last Post: 01-09-2014, 12:54 PM
  3. Convert MQL EA to VTL
    By Snake in forum VertexFX API/VTL Forum
    Replies: 4
    Last Post: 09-12-2013, 08:42 AM
  4. Convert MQL EA to VTL
    By Snake in forum VertexFX API/VTL Forum
    Replies: 4
    Last Post: 09-12-2013, 08:42 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
  •