
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 again why it open the trade but never close it ?
Just a suggestion : if your conditions to close order are the same than opening, order will be close immediatly after open in your code. It's not the opposite ?
like this :
A last thing : when you open order, check the return of function to be sure your order is executed.
Just a suggestion : if your conditions to close order are the same than opening, order will be close immediatly after open in your code. It's not the opposite ?
like this :
A last thing : when you open order, check the return of function to be sure your order is executed.
Hi, yes sir I agree its just an example now its clear thank you .
Hi, yes sir I agree its just an example now its clear thank you .
HI again now it opens an order but doesn't close it I tried to return the value and same issue I don't know what's wrong with my OrderClose here is the code:
Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (strict), it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
You can not use any Trade Functions until you first select an order.
Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (strict), it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit and open at the Ask.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close to a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
You can not use any Trade Functions until you first select an order.
hello, Its a lot of information thank you, can you give me a code example contains OrderClose function so I can fully get it and I'll work the rest of your steps after this one (I mean OrderClose) .
I have deleted your new topic concerning the same code.
Continue here, do not open new topics unnecessarily.
I have deleted your new topic concerning the same code.
Continue here, do not open new topics unnecessarily.
It was a different code but ok :)
hello guys I need a fix to this code please, I researched a lot and couldn't find it . it cant close the trade don't know why? I need an example (I mean Code) or fix to this one .
Thank You.