You buy at the Ask and sell at the Bid.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the 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 at 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 spread 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 buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Hi William, what do you mean by the specified amount? I used the Ask as the base line and add the stop loss which is 5 pips to trail it, is this not specified?
- Luandre Ezra what do you mean by the specified amount? I used the Ask as the base line and add the stop loss which is 5 pips to trail it, is this not specified?
You added 5 pips. Is that a specific amount?
-
double stopLossPrice = Bid + trailingStop*Point();
You did not add that to the Ask. Your effective SL is 5 pips minus the spread. -
if(EMACrossing() == 2 && Volume[0]==1)
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
I don't understand your meaning by specific amount? Is it specific with the meaning of is it enough amount of pips or specific like it should be like this specific price?
You did not add that to the Ask. Your effective SL is 5 pips minus the spread.
Do you mean I should change the Bid into Ask? it's for the short position and this is the code before I realize I made that mistake. I already change the bid with the ask and minus it with the spread
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
Thank you for this info I don't know about this. If you can elaborate more about the Bars and Volume why both of it is unreliable? from my understanding MT4 would see the current bars is bars no.0, even if the MT4 is refresh or reconnect the current bars would still be the no.0 bars. And for the Volume I think this could be happened if the MT4 is refresh or reconnect due to MT doesn't realize how many ticks has happened since the first bars.
Luandre Ezra: Do you mean I should change
Luandre Ezra: can elaborate more about the Bars and Volume why both of it is unreliable?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
and here's my open position code.
anyone knows how this is happened?