![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
Here are my SL/TP settings when executing buy orders.
May I ask if there are any issues with these settings?
_shiftLowPrice is the lowest price over the past few days.
for starters, when you open a buy trade you use Ask (price) and when you close a buy trade you use Bid (price). And get used to using _Point instead of the MarketInfo, or use it like this
double pnt = MarketInfo(Symbol(),MODE_POINT);
and then use the pnt instead of MarketInfo for 2nd, 3rd time.
But looks ok to me otherwise, it is that RiskRewardRatio that is not described. I can only assume that that is the culprit.
Please, always use the CODE button (Alt-S) when inserting code.
for starters, when you open a buy trade you use Ask (price) and when you close a buy trade you use Bid (price). And get used to using _Point instead of the MarketInfo, or use it like this
double pnt = MarketInfo(Symbol(),MODE_POINT);
and then use the pnt instead of MarketInfo for 2nd, 3rd time.
But looks ok to me otherwise, it is that RiskRewardRatio that is not described. I can only assume that that is the culprit.
Thank you for your reply.
The RiskRewardRatio variable is an Int with a value of 2.
The MarketInfo place sometimes calls a function, so for convenience of display I just repeated the writing.
So do you think it could be an issue with the trading platform?
Here are my SL/TP settings when executing buy orders.
May I ask if there are any issues with these settings?
_shiftLowPrice is the lowest price over the past few days.
The error is your calculation. You used the MarketInfo where the price was already valid until you added the 2nd MarketInfo. Proposed changes...
The error is your calculation. You used the MarketInfo where the price was already valid until you added the 2nd MarketInfo. Proposed changes...
Thank you for your reply. My TP is not just RRR*ATR. Below is the logic for my SL/TP, and I have previously Printed out the values (in my earlier screenshots).
I will use the example image to do the calculations. Also, correcting my RRR value to 3.
SL: Recent low - ATR value
TP: Current price + ((Current price - SL)*RRR)
[Sell Order]
OpenPrice: 145.619
SL: 146.197
TP: 145.619 - ((146.197 - 145.619)*3) = 143.885
Thank you for your reply. My TP is not just RRR*ATR. Below is the logic for my SL/TP, and I have previously Printed out the values (in my earlier screenshots).
I will use the example image to do the calculations. Also, correcting my RRR value to 3.
SL: Recent low - ATR value
TP: Current price + ((Current price - SL)*RRR)
[Sell Order]
OpenPrice: 145.619
SL: 146.197
TP: 145.619 - ((146.197 - 145.619)*3) = 143.885
yes, i do remember seeing the original tps were correct, and the modified tps being the issue, so why do you have 2 different calculations for the tp? why now use the same calculation?
The isse you had was that you used MarketInfo(Point) 1 too many times in that math/calculation.
The isse you had was that you used MarketInfo(Point) 1 too many times in that math/calculation.
Do you mean not to use MarketInfo or to pull out MarketInfo for sharing? The attached file is my current implementation which has already pulled out MarketInfo for sharing and is the same as the writing approach you suggested in your previous reply. Or do I need to change to another implementation?
Image of code removed by moderator.
Please don't post images of code. Post the actual code with the the CODE button (Alt-S). You have already been advised about this.
Thank you for the reminder.
Thank you, everyone.
I've found the issue and I'll explain to prevent others from encountering the same problem in the future.
I had previously created a file in the 'Include' folder where I stored commonly used functions.
Yes, this also included the function for placing trades.
When multiple EAs simultaneously called for trade placements, it caused the issue I experienced.
Logically, it shouldn't have affected it, but I noticed that the Take Profit (TP) set in EUR/USD was actually based on USD/JPY prices.
Due to the significant difference in PIP values between the two, it was easy to identify.
For now, I've moved the trade placement function back into each individual EA for use. Next week, I'll observe the trade placements again.
If no issues arise, then this was indeed the reason.