Read the error message and fix your code.
The error message say ERROR 4107-invarid price but my debug printing show the correct price. I am not see the wrong. Or this may to be use NormalizePrice(Bid)?
chaiya
The error message say ERROR 4107-invarid price but my debug printing show the correct price. I am not see the wrong. Or this may to be use NormalizePrice(Bid)?
chaiya
The error message say ERROR 4107-invarid price but my debug printing show the correct price. I am not see the wrong. Or this may to be use NormalizePrice(Bid)?
chaiya
Your log says "invalid takeprofit for OrderSend function".
As noted by Petr, a invalid price doesn't necessarily mean "Open price".
Your log says "invalid takeprofit for OrderSend function".
As noted by Petr, a invalid price doesn't necessarily mean "Open price".
I revise code as follows, and error still there! chaiya
sell_price=Bid;
sell_TP=NormalizePrice(sell_TP);
sell_SL=NormalizePrice(sell_SL);
sell_price=NormalizePrice(sell_price);
ticket=OrderSend(_Symbol,OP_SELL,sell_lots,sell_price,slippage,sell_SL,sell_TP,order_comment,magic,0);
I revise code as follows, and error still there! chaiya
sell_price=Bid;
sell_TP=NormalizePrice(sell_TP);
sell_SL=NormalizePrice(sell_SL);
sell_price=NormalizePrice(sell_price);
ticket=OrderSend(_Symbol,OP_SELL,sell_lots,sell_price,slippage,sell_SL,sell_TP,order_comment,magic,0);
Your problem is in your TP. Look at your log in your firs post. You try to set NEGATIVE TP:
ORDER_TYPE_SELL, Price=14.270,..., TP=-15.730 => Invalid takeprofit
You should set TP to e.g. 12.270
Your problem is in your TP. Look at your log in your firs post. You try to set NEGATIVE TP:
ORDER_TYPE_SELL, Price=14.270,..., TP=-15.730 => Invalid takeprofit
You should set TP to e.g. 12.270
YES, THANK YOU TO THE POINT..
CHAIYA
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
here is my code:
// A7
//
ticket=OrderSend(_Symbol,OP_SELL,sell_lots,Bid,slippage,sell_SL,sell_TP,order_comment,magic,0);
if(ticket>0)
{
signal_HA[iTF_HA_SL]=0;
HA_last_trade_bartime[iTF_HA]=iTime(_Symbol,TF_HA,0);
}
if(ticket<0)
{
string locate="@_"+__FUNCTION__+IntegerToString(__LINE__);
Print(locate,"-",GetLastError());
print_trading_error(OP_SELL,Bid,sell_lots,sell_SL,sell_TP);
}
And here is the results.
My problem is, this is place to Bid. When sell we place to Bid? But result price(=Bid)==13.92 and Bid is 13.92. This order should be execute but return is ERROR 4107.
Do some one help me what is a wrong in my code.
Chaiya