chaungo: I want is just to get the ATR value at bid price and use this value * 2 as my stop
loss.
- There is no ATR at bid. There is just the ATR.
- Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button)
and
state the nature of your problem.
No free help
urgent help. -
trade.Buy(0.01, NULL, Ask, (Ask-90*_Point), (Ask+75*_Point), 0);
You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP is longer. Don't you want the same/specified amount for either direction?
- Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask 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.)
chaungo:
I'm currrently build an auto trade system and kinda stuck here. All I want is just to get the ATR value at bid price and use this value * 2 as my stop loss. Any input? Sorry for bad script, I just started to get to know mql5 for a few days.
extern double atrSL = 2.0;//Atr stop/take multiplier //-- int StopLoss,TakeProfit; //-- double atr = iATR(NULL, 0, 3, 0); StopLoss = (int)(atr * atrSL / Point); //-- TakeProfit = StopLoss;
quick example using ATR to calculate Stop loss and Take profit, not tested!
![Basic Principles - Trading Operations - MetaTrader 5 Help Basic Principles - Trading Operations - MetaTrader 5 Help](https://c.mql5.com/36/30/basic-principles-trading-operations__1.png)
Basic Principles - Trading Operations - MetaTrader 5 Help
- www.metatrader5.com
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I'm currrently build an auto trade system and kinda stuck here. All I want is just to get the ATR value at bid price and use this value * 2 as my stop loss. Any input? Sorry for bad script, I just started to get to know mql5 for a few days.