PDA

View Full Version : How to call MarketInfo (MQL) in VTL?



diannt
10-08-2013, 08:54 AM
Hello!

I want to get current stoplevel from market. How can I do this?

In MQL it may be done like this:
STOPLEVEL = MarketInfo(Symbol(),MODE_STOPLEVEL);

Hassan-HS
10-08-2013, 09:45 AM
Dears,


Unfortunately there is no way to get Stop offset / Limit offset using VTL, you can open new suggested feature with this issue using this link (http://www.hybrid-solutions.com/support/index.php?/hs/Tickets/Submit).

diannt
10-08-2013, 10:39 AM
Thank you for answer.

One more question.
http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1911 - which one of this identifiers is AccountLeverage?

b_morar
10-08-2013, 12:48 PM
Dear Sir,

You can calculate the leverage (its per symbol) as following :



Result = Contract size / Initial Margin
Leverage=1:Result



Contract Size = Contract size for certain symbol, contact you dealer to get it.
Initial Margin = Initial Margin for certain symbol, contact you dealer to get it.



Ex:


Contract size = 100000 .
Initial Margin = 250

100000/250 = 400 so the leverage equal 1:400

diannt
10-09-2013, 08:11 AM
I want to know take profit, which I put on selected order. And we have 2 functions in VTL API.
OrderGetDouble with ORDER_TP parameter and PositionGetDouble with POSITION_TP parameter.

So, there is one simple question. Which one of them I have to use?

b_morar
10-09-2013, 10:05 AM
Dear Sir,

Let's make it clear.

If you need to get TP or SL for certain pending order do the following:

1- Select order using OrderSelect (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1748)method
2- Use OrderGetDouble (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1749)method to return (SL or TP etc..) values through ByRef parameter, and pass a value of type ENUM_ORDER_PROPERTY_DOUBLE (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3350) to decide which one of information do you need (SL or TP etc..) .

If you need to get TP or SL for certain position do the following:

1- Select order using PositionSelect method
(http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1742)2- Use PositionGetDouble (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1743)method to return (SL or TP etc..) values through ByRef parameter,and pass a value of type
ENUM_POSITION_PROPERTY_DOUBLE (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2595)to decide which one of information do you need (SL or TP etc..) .

.

diannt
10-10-2013, 07:17 AM
Thank you for answers!

Now Im trying to get this code to work and I don't know how!
I just copyed it from here
http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1730

Public Sub main()
MsgBox SymbolName(1,true)
End Sub

and it says "type mistmatch SymbolName".

What's wrong with this function?

Hassan-HS
10-10-2013, 07:43 AM
Dear Diannt


This sample is working well, but could you please check if you are wrote the name of method correctly and check if the terminal is connected and market-watch have prices.

diannt
10-10-2013, 08:39 AM
Dear Diannt


This sample is working well, but could you please check if you are wrote the name of method correctly and check if the terminal is connected and market-watch have prices.

h.abukrayem, thanks for answer.

Yes, the method wrote correctly, terminal is connected and market-watch have prices.
I don't know what's wrong with it.

Seriously, I have no idea. I deleted all another code from my expert and it didn't help.

Hassan-HS
10-10-2013, 08:50 AM
Dear,


Can I see your code using team-viewer?

diannt
10-11-2013, 08:29 AM
Thanks, h.abukrayem, to help with my code throw team-viewer, we got it to work.

Now I have one more question.

My current chart is in minutes, but in code I want to see High of the last day. Can I have the solution?
Like iHigh(Symbol(),PERIOD_D1,LastDay) in MQL.

Hassan-HS
10-11-2013, 09:21 AM
Dear sir,

Absolutely you can do that using ChartSetSymbolPeriod (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2320)method.

please check the following code.




Public Sub main()

if ChartSetSymbolPeriod(0,PERIOD_D1) then
MsgBox GetHigh(0,Bars(0))
end if

End Sub

diannt
10-11-2013, 12:05 PM
Okay, I got it, but in another way, because your makes troubles with charts.

This time we used to know many candles, but VTL show us only around 800. Is there any solution?

Also, we got an error "Invalid price", when use NewLimitOrder function, with any price. We just tried to put price by hand - higher, then price, when buystop, and lower then price - when sellstop.

What can we do with it?

Hassan-HS
10-11-2013, 01:39 PM
Welcome


I don't know what do you means with " makes troubles", whatever you can open new chart using VTL.



Public Sub main()

ChartOpen "EUR/USD",PERIOD_M1
MsgBox GetHigh(Cint(0),Bars(Clng(0))-1)

End Sub



Also, we got an error "Invalid price", when use NewLimitOrder function, with any price. We just tried to put price by hand - higher, then price, when buystop, and lower then price - when sellstop.


Send me your code let me check your prices.

diannt
10-11-2013, 03:49 PM
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.

2. if not NewLimitOrder (-1, CSTR(SymbolName(1,true)), CDbl(1.0), CDbl(1.4)) then
MsgBox ErrorDescription(GetLastError())
end if

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)".

We tried same code with different prices - it does'nt work.

Hassan-HS
10-11-2013, 10:34 PM
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




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:



Public Sub OnTick(Symbol)

End Sub

diannt
10-12-2013, 08:55 AM
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.

Hassan-HS
10-12-2013, 12:08 PM
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.

diannt
10-12-2013, 04:03 PM
We tried this with many, many values without any result.

Higher and lower then current.

Hassan-HS
10-12-2013, 04:52 PM
Dear,

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

diannt
10-14-2013, 02:54 AM
Thank you, h.abukrayem, I'm really waiting for it.

Hassan-HS
10-14-2013, 01:07 PM
Hello,

this code take new limit order for EUR/USD.




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

diannt
10-16-2013, 09:40 AM
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!

Hassan-HS
10-16-2013, 09:51 AM
Welcome :)


You can load all chart candles by pressing"F5" or click over it is icon in the Charts Toolbar (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2195).

diannt
10-16-2013, 10:05 AM
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.

Hassan-HS
10-16-2013, 10:32 AM
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.

diannt
10-24-2013, 11:02 AM
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.

Hassan-HS
10-24-2013, 12:43 PM
Welcome,

Please send me your code, let me check it.

diannt
10-25-2013, 05:12 AM
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

Hassan-HS
10-25-2013, 05:35 AM
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.

Hassan-HS
10-25-2013, 07:04 AM
Dear,,
Please assign a value to variables that exist in OnInit() ;).




Public Sub OnInit()
Buys = 0
Sells = 0
PendingBuy = 0
PendingSell = 0
BuyLots = 0
SellLots = 0
PendingBuyLots = 0
PendingSellLots = 0
Profit = 0
lastBarTime = CurTime()

If CInt(Digits) = 3 or CInt(Digits) = 5 then
TrailingStop = CDBL(TrailingStop * DECIMAL_CONVERSION)
TrailingProfit =CDBL( TrailingProfit * DECIMAL_CONVERSION)
StopLoss = CDBL(StopLoss * DECIMAL_CONVERSION)
Anchor = CDBL(Anchor * DECIMAL_CONVERSION)
end if

trailingStop1 = CDBL(TrailingStop * CDbl(Point))
trailingProfit1 = CDBL(TrailingProfit * CDbl(Point))
stopLoss2 = CDBL(StopLoss * CDbl(Point))

STOPLEVEL = 0
Denominator = 200
lastBarTime = CurTime()
End Sub

diannt
10-25-2013, 10:46 AM
Okay. I did it well, thank you.

Can you help me now with DeleteLimitOrder function?

How can I get ticket for this function, if I have to get ticket from limit order, not market?

Hassan-HS
10-25-2013, 11:55 AM
Hello Dinat,

Already we are developing OrderGetTicket function, that made you able to retrieve order id by it is index, It will be released ASAP.

I will update you very soon, please standby.

Hassan-HS
10-25-2013, 03:21 PM
Dear Sir,

The following features that requested by you are under process.
1-STOPLEVEL ( SL/TP Offset ).
2-iHigh,iLow etc...
3-Leavarge.
4-Load All Chart Data by VTL.
5-OrderGetTicket.



Note: And you can contact our technical support (http://www.hybrid-solutions.com/support/) to increase numbers of the bars of charts if you are use VertexFX Trader 10 (Demo System)
or contact your dealing room if you are use another system.

Please let me know if you have another inquiry.

Hassan-HS
10-27-2013, 01:54 PM
Dear Dinnat,


I have checked our source code, then i found function that is called OrderGetID (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3968) returns The OrderID based on it is index.





Public Sub main()
Msgbox OrderGetID (1)
End Sub

diannt
10-28-2013, 08:32 AM
Hello! Nice, that you found this function.

Please, help me with one more now... I'm trying to count selllots and buylots.
And my function crashes when it try to get OrderSymbol().

What's wrong with it?

Dim Counter
For Counter=1 to PositionTotal() 'opened orders
OrderSelectByIndex Clng(Counter)
PositionSelect Clng(Counter)
if OrderSymbol() = CSTR(named) then
OrderGetDouble ORDER_TP,ProfitOld
PositionGetDouble POSITION_SWAP,Swap
Profit = Profit + ProfitOld + Swap
If OrderType() = -1 then 'sell limit and sell
SellLots = CDBL(SellLots + OrderLots(Clng(Counter)))
Sells = Sells + 1
End if
If OrderType() = 1 then 'buy and buy limit
BuyLots = CDBL(BuyLots + OrderLots(Clng(Counter)))
Buys = Buys + 1
End if
End if
Next

Hassan-HS
10-28-2013, 10:05 AM
Dear Sir,

maybe you have misunderstanding between Positions and the Orders.

Positions: The orders that have been already opened.

Orders: The pending orders (limits orders.managed orders)

In the attachment photo that describe the location of the positions and orders in the trade panel (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2199).
1=> Positions
2=>Orders

Functions related to positions:
PositionTotal (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1740)
PositionGetSymbol (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1741)
PositionSelect (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1742)
PositionGetDouble (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1743)
GetPositionType (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1744)
GetPositionTime (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1745)
GetPositionSymbol (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1746)
CloseMultiPositions (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3746)
PositionGetTicket (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/2906)
RequestManageOrders (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3651)



Functions related to orders:
OrdersTotal (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1747)
OrderSelect (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1748)
OrderGetDouble (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1749)
OrderGetString (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1750)
OrderPrice (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1751)
OrderSymbol (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1752)
OrderTime (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1753)
OrderType (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1754)
OrderLots (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3351)
OrderSelectByIndex (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3352)
OrderGetID (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3968)


Total Lots For Positions Sample & Total Lots For Orders Sample:





Public Sub main()

Dim TotalPostionsLots
Dim Temp
TotalPostionsLots=0
Temp=0
For Counter=1 To PositionTotal()
If PositionSelect(PositionGetTicket(Clng(Counter))) Then
If PositionGetDouble(POSITION_AMOUNT,Temp) Then
TotalPostionsLots=TotalPostionsLots + Temp
End If
End If

Next


MsgBox "The total positions lots is: " & TotalPostionsLots

Dim TotalOrdersLots
Dim Temp1
TotalOrdersLots=0
Temp1=0

For Counter=1 To OrdersTotal()
Temp1=OrderLots(OrderGetID(CInt(Counter)))
TotalOrdersLots=TotalOrdersLots+Temp1
Next

MsgBox "The total orders lots is: " & TotalOrdersLots

End Sub

diannt
10-28-2013, 11:24 AM
Thank you very much, it was really helpful.

Now one more question.

http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3632

Can we use this function for positions?
How can we make trailing stop for positions, if we cant use this function for positions?

b_morar
10-28-2013, 02:35 PM
Dear Dinnat,

If you need to manage a position (give it SL/TP) for the first time you have to pass PositionID to NewSLTPOrder (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3622) function.

Notice That is a new order will be add into Pending Order list view and it is called Manage Order.

This Sample create new EUR/USD position and manage it for the first time.


Dim PositionType
Dim Amount
Dim SymbolName
Dim PositionID
Dim TP
Dim SL
Dim Offset

Public Sub main()
' Open A New Market Order
PositionType= TRADE_ACTION_SELL
Amount= 1
Offset=10
SymbolName="EUR/USD"
NewMarketOrder Cint(PositionType),CSTR(SymbolName),CDBL(Amount)
End Sub


'To Get Market Order ID
Public Sub OnPositionTrade (actionType ,ticketID)
Dim Temp
' 5 Means New Position Has Been Opened
If actionType = 5 then
PositionID= ticketID
'Set Manage Order for this Position for the 1st time
MsgBox "THE POSITION HAS BEEN CREATED"
SymbolInfoDouble CSTR(SymbolName),SYMBOL_ASK,Temp

If PositionType = -1 then
SL=Temp+Offset
TP=Temp-Offset
elseif PositionType=1 then
SL=Temp-Offset
TP=Temp+Offset
End if
NewSLTPOrder Clng(PositionID),Cdbl(Amount),Cdbl(SL),Cdbl(TP)



end if
' 9 Means A Position Has Been Managed
If actionType = 9 then
MsgBox "THE POSITION HAS BEEN MANAGED"
End if
End Sub

Now if you need to update the SL/TP for a position that already have SL/TP you must know it's managed OrderID and you can get it using RequestManageOrders (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3651).

Why all this ? Becuase the VertexFX platform supports the Partial Position Managment, that means the one position may have more than one managed order.

Ex:
Position : "GOLD"- 10 lot
May managed partially as following:
"GOLD" 2 lots SL: 1300
"GOLD" 3 lots SL: 1400 TP 1000
"GOLD" 5 lots SL: 1300 TP 900


This sample describe how to get the managed order ID.




Public Sub main()
If AccountInfoInteger(ACCOUNT_LOGIN) Then
' 3666=> Position ID

If RequestManageOrders (3666) Then
MsgBox "The Request has been sent to the server to get all manage orders related to ticket number 3666 "
Else
MsgBox ErrorDescription(GetLastError())
End If
End If

End Sub
'This event raised when calling RequestManageOrders method successfully
Public Sub OnManageOrdersReceived(manageOrders)
Dim i
' Receiving Manage Order related to Ticket 3666
For i = 1 To manageOrders.Count()
MsgBox CSTR(manageOrders. Orders(i))
Next
End Sub


Finally you can update the SL/TP by passing the managed orderID to UpdateSLTPOrder (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3632) function.



Public Sub main() If AccountInfoInteger(ACCOUNT_LOGIN) Then

' 1334=> managed OrderId

If UpdateSLTPOrder (1334,0.1,1980,0.36578) Then MsgBox "Order has been Updated "
Else
MsgBox ErrorDescription(GetLastError())
End If
End If

End Sub

diannt
10-29-2013, 04:51 AM
b_morar, thank you!

But we need something else:

Our expert's logic open pending orders with SL and TP. And when our pending order is position we have to change it. Can we do it in the same way?
Can we just RequestManageOrders and then get our and do UpdateSLTPOrder on it?

Hassan-HS
10-29-2013, 07:06 AM
Dear dinnat,


I didn't understand your idea at all, anyway I'll explain what you have to do in the all cases.


1-If you have a position and it's not have SL/TP , you can assign SL/TP by passing PositionID to NewSLTPOrder (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3622).

Note : NewSLTPOrder (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3622) takes PositionID only.

2-If you have managed order and you need to update it's SL/TP values you can pass order ID to UpdateSLTPOrder (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3632)


3-If you have limit order and you need to update it's SL/TP values you can pass order ID to UpdateLimitOrder (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1739)

Tips about RequestManageOrders (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3651)

1- There is no necessary to call it if are you know the ID of the pending order whether limit order or manage order.

2- You should call it if you have position and do you need to retrieve its managed orders to update it's SL/TP, because the UpdateSLTPOrder (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/3632) function takes OrderID only.

diannt
10-29-2013, 09:24 AM
h.abukrayem, okay, thank you. I got it in the same way.

Now, please, let me know - what's wrong with this code?

This one works well!
Public Sub main()

Dim OpenPrice
Dim Offset
SymbolInfoDouble "EUR/USD",SYMBOL_ASK,OpenPrice
Offset=0.1
OpenPrice=OpenPrice+0.01

if not NewLimitOrder (2,"EUR/USD",0.1,Cdbl(OpenPrice),Cdbl(OpenPrice)-Cdbl(Offset),Cdbl(OpenPrice)+Cdbl(Offset) ) then
MsgBox ErrorDescription(GetLastError())
end if
End Sub

And now... Magic! this one can't work!
It says "Invalid Price" without SL and TP, which are "Option" for NewLimitOrder function.

Public Sub main()

Dim OpenPrice
Dim Offset
SymbolInfoDouble "EUR/USD",SYMBOL_ASK,OpenPrice
Offset=0.1
OpenPrice=OpenPrice+0.01

if not NewLimitOrder (2,"EUR/USD",0.1,Cdbl(OpenPrice) ) then
MsgBox ErrorDescription(GetLastError())
end if
End Sub

Hassan-HS
10-29-2013, 10:03 AM
You can open 4 types of orders with its prices as following :

Notes :
1-You can define OpenPrice,TP,SL for your custom order.
2-There is two parameter of offset Stop offset / Limit offset



Buy Limit

Open Price < Ask- Limit Offset

SL < Open Price - Stop Offset

TP > Open Price +Limit Offset


Sell Limit

Open Price > Bid+ Limit Offset

SL > Open Price + Stop Offset

TP < Open Price - Limit Offset


Buy Stop

Open Price > Ask+ StopOffset

SL < Open Price - Stop Offset

TP > Open Price +Limit Offset



Sell Stop

Open Price < Bid - StopOffset

SL > Open Price + Stop Offset

TP < Open Price - Limit Offset

You can contact your dealer ( or our support department (http://www.hybrid-solutions.com/support/visitor/index.php?/LiveChat/Chat/Request/_sessionID=b6c1ig9t2c0mqh1k49vushtcsfwk7il5/_proactive=0/_filterDepartmentID=20%2C11%2C9%2C4%2C30/_randomNumber=44/_fullName=/_email=/_promptType=chat) if you are use our system )to get your Stop & Limit Offsets.

diannt
10-30-2013, 11:43 AM
Thank you very much, finally we did it!

Can you help now with logging function?

We have'nt seen any one yet. "Print" does'nt work.

b_morar
10-30-2013, 01:27 PM
Dear sir,

You have to use PrintData (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1757)function to enters a message in the log file.

Hassan-HS
01-09-2014, 02:35 PM
Dear Sir,


It's our pleasure to tell you that the new version of VertexFX 10.2 is available, you can check the release notes through this link (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/4008/13/vertexfx-1024-beta)



1-STOPLEVEL ( SL/TP Offset ). : you can use the new SymbolInfoDouble (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1732)

2- iHigh (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/4022), iLow (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/4023), iOpen (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/4024), iClose (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/4025), iTime (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/4026)

3-Leavarge.you can use the new SymbolInfoDouble (http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1732) to get the contract size to calculate it.