- What do you think this line does?
for(int pos=0;pos<total;pos++) if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)) OrderProfit();
- Check your return codes (OrderSend) and find out why.
What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- What price are you setting your SL/TP to?
- Which order do you think a refers to?
double a=OrderProfit()
ayoub:
1.if not order, open a just one new order
3.stop lose and take profit
4profit order open
- The line does nothing. It doesn't check for anything.
- Ignored
- SL=50*vpoint is not a price
- If there is only one open order (from the send,) there is no selected order. If there are two open orders, it is the previous one.
so haw can i open a simple order please
ayoub:
so haw can i open a simple order please
so haw can i open a simple order please
Check if an order is already open if Yes { Do nothing } if No { Do I want to open a Buy or a Sell if Buy { Caculate SL at Ask minus SL amount Caculate TP at Ask plus TP amount Send Buy order at Ask, with calculated SL and TP Check if OrderSend was successful, if not print an error report } if Sell { Caculate SL at Bid plus SL amount Caculate TP at Bid minus TP amount Send Sell order at Bid, with calculated SL and TP Check if OrderSend was successful, if not print an error report } }Write code to do exactly what you would do if opening a trade manually
GumRai:
Write code to do exactly what you would do if opening a trade manually
I want just to know why it not open order when i use the previous codeWrite code to do exactly what you would do if opening a trade manually
what the error code or code forget
ayoub: I want just to know why it not open order when i use the previous code
| If you had answered my questions, you would know why. |
ayoub:
I want just to know why it not open order when i use the previous code
what the error code or code forget
I want just to know why it not open order when i use the previous code
what the error code or code forget
WHRoeder has already pointed you in the right direction and in my post
Do I want to open a Buy or a Sell if Buy { Caculate SL at Ask minus SL amount Caculate TP at Ask plus TP amount Send Buy order at Ask, with calculated SL and TP Check if OrderSend was successful, if not print an error report } if Sell { Caculate SL at Bid plus SL amount Caculate TP at Bid minus TP amount Send Sell order at Bid, with calculated SL and TP Check if OrderSend was successful, if not print an error report }
Calculate your SL and TP properly
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi,
i build this expert but it can't place orders ,Is there a mistake