PDA

View Full Version : How to send a pending Limit Order from client side VTL



Edakad
02-17-2015, 05:39 AM
Hello

How to send a pending Limit Order from client side VTL.

http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1737 . The documentation appears to be opening new limit order but the example modifies an already open position

Is there any method to open a new pending order from VTL script

Edakad
02-17-2015, 05:44 AM
Sorry, It seems the example code made the confusion here, the pending order opened as expected

Hassan-HS
02-17-2015, 07:43 AM
Hello,

These things happen ;), good luck

Edakad
02-17-2015, 11:38 AM
Hello Hassan

Now requesting help on another issue

I am sending a StopLimit pending order from VTL, and the order appears with the defines stoplosss and target.

Now when the order is executed, the stoploss and target appears to be null
Later when I restart VertexFx Terminal, the StopLoss and Target appears with the position

Please see the 2 images

http://i59.tinypic.com/2qiwa41.png

http://i57.tinypic.com/23w8tg0.png


Now the problem I am facing is when I can't get the stoploss from open position in VTL and adjust stop loss as per logic. If I restart terminal it works. I am working with CLIENT SIDE script

Hassan-HS
02-17-2015, 04:40 PM
Dear Edkad,


I reported this issue to our development department, they will check this as soon as possible.

Edakad
02-18-2015, 07:46 AM
Thanks, if it is available without using Manage Order, it is much easier to code EAs

Edakad
02-18-2015, 09:01 AM
Hello Hassan

Here is another issue I am facing

Please put one buy stop and sell stop order into the terminal and then run this code


Public Sub main()

for i = 1 to ordersTotal()

OrderSelectByIndex(i)

msgBox orderType()


next

End Sub

Now the documentation (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2596) says sell stop order has a return value -2 with OrderType() function. However the return value is 2, not -2.

This is causing issues in identifying buy stop ans sell stop orders.

Is it a bug in the system or am I done it wrong ?

Hassan-HS
02-19-2015, 05:13 AM
Hello

I will check it then i will update you

Edakad
02-19-2015, 09:49 AM
Dear Hassan,

One more situation

Please open 2 charts and put 2 stop buy or stop sell orders. Now when both the orders are executed, add this VTL script to both charts. This calls the RequestManageOrders() sub and displays the order IDs from OnManageOrdersReceived().





''' <summary>
''' The function is generated when a new tick is received fro any symbol
''' </summary>

Public Sub OnTick(SymbolName)
if symbolName = chartSymbol(0) then
for i = 1 to PositionTotal()
positionSelect(PositionGetTicket(CINT(i)))
if PositionGetSymbol(CINT(i)) = chartSymbol(0) then
RequestManageOrders CLNG(PositionGetTicket(CINT(i)))
end if
next


end if

End Sub

public sub OnManageOrdersReceived(manageOrders)

For i = 1 To manageOrders.Count()
orderSelect manageOrders.Orders(CINT(i))
msgbox CLNG(manageOrders.Orders(CINT(i)))
next

End Sub

''' <summary>
''' The main function is the entry point for any Script program
''' </summary>

Public Sub main()
'''TODO: Script program start method


End Sub

I am getting one orderID correct as shown in terminal, but one is wrong, it truncates the last digit of order id. However this script works fine when the script is added to only one chart. This makes the same script unreliable when attached to 2 different charts at the same. Please check and guide me

Thanks and Regards

Hassan-HS
02-20-2015, 06:32 AM
Dear Edkad,


Please use this way, we already fixed OrderType in the next version




Public Sub main()
for i = 1 to ordersTotal()
OrderSelectByIndex(i)
OrderGetInteger OPERATION_TYPE_ENUM,result
msgBox result
next
End Sub

Hassan-HS
02-20-2015, 07:10 AM
Dear Edkad,


I'll open ticket with the development team, to check the second issue.

Edakad
02-20-2015, 09:10 AM
Thank You Hassan

Hassan-HS
03-01-2015, 08:05 AM
Dear Edkad,




We are glad to inform you that SL/TP issue has been fixed in the next version.

Edakad
03-01-2015, 11:14 AM
Dear Edkad,




We are glad to inform you that SL/TP issue has been fixed in the next version.

Dear Hassn, that is gr8. When can we expect the next version