@Irwan: The threadstarter wrote: "with SL=0 and TP = 0" ;-)
Here my test code: (Snippet) where an Order is set without SL and TP and after successful creation, I add SL and TP. (Only in this case. Not always... ;-) )
ticket = OrderSend(Symbol(), cmd, lots, inPrice, Slippage, 0, 0, NULL, 333, 0, clrNONE);
if (ticket != -1)
{
if (OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES) == true)
{
if (OrderModify(ticket, OrderOpenPrice(), sl, tp, NULL, clrNONE) == true)
{
_toolManager.SendMessage("Added TP and SL successful.", clrLimeGreen);
}
else
{
_toolManager.SendMessage("Could not set SL and TP!!", clrRed);
}
}
else
{
_toolManager.SendMessage("Could not set SL and TP!", clrRed);
}
}
Here are the results of the code and the results of manual trading: (From bottom to top)
1. I first tried to open an order by code, without SL and TP as a sell stop order.
-> I got the error message Invalid SL or TP.
2. I opened a market order by code
-> Success, but modification of SL and TP after the order was placed failed. (For the moment not so important, because I did not check the min values for SL and TP)
3. I've tested, if the sell stop is the problem and opened a sell stop without TP and SL by hand.
-> Success.
I've tried sell stop orders by code with slippage-values from 0 to 100. All failed.
I must say, that I have never traded futures and maybe there are some things I do not know... My code works fine for all other instrument types (forex, indices, cfd), but in this special case I have a problem...
@Irwan: The threadstarter wrote: "with SL=0 and TP = 0" ;-)
Here my test code: (Snippet) where an Order is set without SL and TP and after successful creation, I add SL and TP. (Only in this case. Not always... ;-) )
Here are the results of the code and the results of manual trading: (From bottom to top)
1. I first tried to open an order by code, without SL and TP as a sell stop order.
-> I got the error message Invalid SL or TP.
2. I opened a market order by code
-> Success, but modification of SL and TP after the order was placed failed. (For the moment not so important, because I did not check the min values for SL and TP)
3. I've tested, if the sell stop is the problem and opened a sell stop without TP and SL by hand.
-> Success.
I've tried sell stop orders by code with slippage-values from 0 to 100. All failed.
I must say, that I have never traded futures and maybe there are some things I do not know... My code works fine for all other instrument types (forex, indices, cfd), but in this special case I have a problem...
The ticksize for this symbol is 1.00, you can use price 1057.61 or 1116.88
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
@Irwan: The threadstarter wrote: "with SL=0 and TP = 0" ;-)
Here my test code: (Snippet) where an Order is set without SL and TP and after successful creation, I add SL and TP. (Only in this case. Not always... ;-) )
Here are the results of the code and the results of manual trading: (From bottom to top)
1. I first tried to open an order by code, without SL and TP as a sell stop order.
-> I got the error message Invalid SL or TP.
2. I opened a market order by code
-> Success, but modification of SL and TP after the order was placed failed. (For the moment not so important, because I did not check the min values for SL and TP)
3. I've tested, if the sell stop is the problem and opened a sell stop without TP and SL by hand.
-> Success.
I've tried sell stop orders by code with slippage-values from 0 to 100. All failed.
I must say, that I have never traded futures and maybe there are some things I do not know...
My code works fine for all other instrument types (forex, indices, cfd), but in this special case
I have a problem...
@Irwan: The threadstarter wrote: "with SL=0 and TP = 0" ;-)
Here my test code: (Snippet) where an Order is set without SL and TP and after successful creation, I add SL and TP. (Only in this case. Not always... ;-) )
Here are the results of the code and the results of manual trading: (From bottom to top)
1. I first tried to open an order by code, without SL and TP as a sell stop order.
-> I got the error message Invalid SL or TP.
2. I opened a market order by code
-> Success, but modification of SL and TP after the order was placed failed. (For the moment not so important, because I did not check the min values for SL and TP)
3. I've tested, if the sell stop is the problem and opened a sell stop without TP and SL by hand.
-> Success.
I've tried sell stop orders by code with slippage-values from 0 to 100. All failed.
I must say, that I have never traded futures and maybe there are some things I do not know...
My code works fine for all other instrument types (forex, indices, cfd), but in this special case
I have a problem...
The ticksize for this symbol is 1.00, you can use price 1057.61 or 1116.88
Forum on trading, automated trading systems and testing trading strategies
OP_BUYSTOP/OP_SELLSTOP OrderSend with SL=0 and TP=0 return me error 130 (invalid stops!)
Alain Verleyen, 2015.01.08 16:30
A BUY_STOP needs to be place at a higher price than market price, not lower.
Is your price calculated ? You have to normalize your price in this case.
Normalized OrderInPrice? Or normalized OrderTakeProfit and/or OrderStopLoss? Or both?
If it's necessary for SL and TP than SL = 0 and/or TP = 0 is not allowed?
Thank you!