Page 5 of 5 FirstFirst ... 345
Results 61 to 73 of 73
  1. #61
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    411

    Default

    Dear

    Can you send to me your fully code as private message, it is not working in my side

  2. #62

    Default

    My question is just that how can i avoid these errors "unable to get a quote due to bad connection" and "unable to get a quote due current market condition" occurred when place marketorder(buy/sell)??? how can i do to attempt again again until order get executed......????

  3. #63
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    411

    Default

    Dear

    "unable to get a quote due to bad connection " error occurs:
    1- when your internet connection is bad.
    2- when you use MsgBox method on your code, the client terminal suspended until the user responds to the message box, which is delay your request, I suggest to use AlertMessage instead of it.

    And about "unable to get a quote due current market condition" message it is not problem the system prevents you to get any order at symbol if not tick for X time

  4. #64

    Default

    I need some sample code that attempt again for order placement on tick for next time/Xtime.....
    I want code for example that try until the order get executed... even these order occurred. I see some one had done it but i did not remember the link
    Please Dear share some code that attempt again when these error happen until market order get executed......

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

    Default

    Hello

    OK, we will send you sample code soon please standby.

  6. #66

    Default

    Thanks Hassan!!! and please give me sample the close all my opened positions(buy/sell) for specific symbol and open a new position(buy/sell) for that symbol with desire lot size....????

  7. #67
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    411

    Default

    Dear

    You can handle the happen error by waiting the OnOrderTrade event by using the returnValue form this event check this sample.

    Code:
    Dim SymbolName 
    SymbolName= "EUR/USD"
    Dim lot 
    lot= 1
    Public Sub main()
    ''''TODO: Script program start method
       If AccountInfoInteger(ACCOUNT_LOGIN) Then ' Check if account is selected.
         NewMarketOrder TRADE_ACTION_BUY,Cstr(SymbolName) ,CDBL(lot) ' Returns True if buy operation was successful.
       Else 
       AlertMessage "Select account."
       End if 
    End Sub
    
    
    Public Sub OnOrderTrade(actionType ,orderID , returnValue)
    if  returnValue = 4 then 
     NewMarketOrder TRADE_ACTION_BUY,Cstr(SymbolName) ,CDBL(lot)
    else 
    AlertMessage "returnValue"
    End IF
    End Sub
    And the bellow code to close all position by using CloseMultiPositions method may it will help you

    Code:
    Dim Ticket 
     Dim lot 
     Dim Tickets 
     Dim Lots
      If PositionTotal= 0 then exit sub 
        For i= 1 to PositionTotal
          Ticket = PositionGetTicket(Clng(i))
          result = PositionSelect(Clng(Ticket))
           if (Cbool(result) = True) then
               PositionGetDouble POSITION_AMOUNT, lot
            if i = 1 then
              Tickets = cstr(Ticket)
            else
              Tickets = cstr(Tickets) + "," + cstr(Ticket)
            end if
              if i = 1 then
                lots = cstr(lot)
              else
                lots = cstr(lots) + "," + cstr(lot)
              end if
         end if
       next
       CloseMultiPositions cstr(tickets), cstr(lots)
    Last edited by Rawan-HS; 12-15-2015 at 08:19 AM.

  8. #68

    Default

    I want to know when these message/alert trigger???
    Similarly the case with the alert message of bad connection??? when that message/alert occure


    Click image for larger version. 

Name:	AlertMessage.JPG 
Views:	32 
Size:	116.6 KB 
ID:	427

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

    Default

    Hello,

    This error occurs when your request takes more than 5 seconds to reach the server.

  10. #70

    Default

    Its mean if I run this type of script on server side VTL then this issue will not occur. also the bad connection error will also not come in that case?? is am right??

    How can I debug the server Side Script????

  11. #71
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    411

    Default

    Dear

    Yes this problem will be solved if you run it on the server side

    you can check our VTL server side documentation .
    and you can check this server side script may be it will help you to write your code .

  12. #72

    Default

    What is the best way to convert VTL client side script to VTL server side script..???

  13. #73
    Administrator Rawan-HS's Avatar
    Join Date
    Apr 2015
    Posts
    411

    Default

    Dear rizwan

    there is no bast way to convert from client side to server side.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to define a function in VTL Script
    By magicmao2014 in forum VertexFX API/VTL Forum
    Replies: 4
    Last Post: 06-01-2014, 08:56 AM
  2. VTL Script CloseAllWithBenifit
    By imranhashmi92 in forum VertexFX API/VTL Forum
    Replies: 1
    Last Post: 05-15-2014, 03:00 PM
  3. help needed in VTL script
    By tarun in forum VertexFX API/VTL Forum
    Replies: 1
    Last Post: 03-06-2014, 06:44 AM
  4. How to call MarketInfo (MQL) in VTL?
    By diannt in forum VertexFX API/VTL Forum
    Replies: 45
    Last Post: 01-09-2014, 02:35 PM

Tags for this Thread

Posting Permissions

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