Just because your car can go 150 MPH doesn't mean you should. Just because you have a lot of margin, doesn't mean you should use it. Control your risk.
Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin or leverage. No SL means you have infinite risk (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% account total.
-
You place the stop where it needs to be — where the reason for the trade is no longer valid. E.g. trading a support bounce, the stop goes below the support. Then you compute your lot size.
-
AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/PIP, but it takes account of the exchange rates of the pair vs. your account currency.)
-
Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
MODE_TICKVALUE is not reliable on non-fx instruments with many brokers - MQL4 programming forum (2017)
Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum (2018)
Lot value calculation off by a factor of 100 - MQL5 programming forum (2019) -
You must normalize lots properly and check against min and max.
-
You must also check Free Margin to avoid stop out
-
For MT5, see 'Money Fixed Risk' - MQL5 Code Base (2017)
Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5 or 0.1 Lots maximum.
Just because your car can go 150 MPH doesn't mean you should. Just because you have a lot of margin, doesn't mean you should use it. Control your risk.
Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin or leverage. No SL means you have infinite risk (on leveraged symbols). Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% account total.
-
You place the stop where it needs to be — where the reason for the trade is no longer valid. E.g. trading a support bounce, the stop goes below the support. Then you compute your lot size.
-
AccountBalance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the spread, and DeltaPerLot is usually around $10/PIP, but it takes account of the exchange rates of the pair vs. your account currency.)
-
Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
MODE_TICKVALUE is not reliable on non-fx instruments with many brokers - MQL4 programming forum (2017)
Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum (2018)
Lot value calculation off by a factor of 100 - MQL5 programming forum (2019) -
You must normalize lots properly and check against min and max.
-
You must also check Free Margin to avoid stop out
-
For MT5, see 'Money Fixed Risk' - MQL5 Code Base (2017)
Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5 or 0.1 Lots maximum.
Hey William, I'm a little confused... I limit risk per trade to 0.1 % of account balance, I do trade a portfolio of ea's so theres a lot going on at any one time but I limit the amount of risk exposure to 1.75% of the account balance (including pending orders). Is there something I missed?
If you have a high Maximum Favourable Excursion (MFE) but a low Exit Accuracy, as your graph shows, then it is a sign that your strategy or your risk/money management is not adequate to capture it.
Scaling out is an option but the the most commonly used method to counter it, is the use of a trailing stop. Implement a trailing stop method that fits your strategy and your risk requirements.
If you wish, combine both the scaling out and the trailing stop. Experiment and see which combination of is best for your strategy.
Another point to mention based on your graph, is that you are not implemented a proper stop-loss. If you are indeed applying a 1.75% maximum risk, then it should not be possible for your Maximum Adverse Excursion (MAE) to go beyond that. Yet your graph shows a few days where it went beyond that and even one day where it went almost as far as 4%.
You are clearly not controlling your risk with a stop-loss on each position, or in the least a general basket type stop-loss for all the open positions.
Here is how to calculate net mean (average) price values for your basket of positions ...
Forum on trading, automated trading systems and testing trading strategies
Looking for indicator that gives the info tp of the globality of open trades please
Fernando Carreiro, 2022.10.12 16:05
No such indicator exists as far as I known. It will have to be coded (use the Freelance section), but it will be easier to just have your existing EA be modified to show that target on the chart using the following maths:
- vi = volume of individual position
- oi = open price of individual position
- ci = close price of individual position
- Vn = total volume for a basket of positions
- On = net mean open price for a basket of positions
- Cn = net mean close price for a basket of positions
- PLn = profit/loss for a basket of positions
Another point to mention based on your graph, is that you are not implemented a proper stop-loss. If you are indeed applying a 1.75% maximum risk, then it should not be possible for your Maximum Adverse Excursion (MAE) to go beyond that. Yet your graph shows a few days where it went beyond that and even one day where it went almost as far as 4%.
You are clearly not controlling your risk with a stop-loss on each position, or in the least a general basket type stop-loss for all the open positions.
Here is how to calculate net mean (average) price values for your basket of positions ...
Thanks for you're feedback I appreciate that, is there anything into the strategy side of things that I can do? I believe that's were the problem is stemming from in my opinion. As a side note I have taken care of all you're points (thanks for that formula by the way I didn't realize there was such a thing for that that is awesome). I've got multiple scale-outs and trails implemented and that little blip was just an experiment gone wrong lol.
It sure is wild how I can have everything dialed in in the strategy tester (MFE included) but it just falls flat on it's face in live trading, I do my best to avoid curve fitting but maybe it really is just that simple..
You are welcome! Given that I have no ideia of your strategy, I don't think it plausible to be able to offer suggests for improving it. All I am able to do, is suggest risk/money/trade management ideias.
When back-testing in the Strategy Tester, make sure to test with real tick data and to enable the simulation of delays (slippage).
The back-test should be used for verifying that the rules are being properly implemented, not so much for optimisation. Optimisation, is based on "past" data and will be different on "future" data.
Instead, build into your strategy, rules that are robust and adjust accordingly to different market conditions when possible.
If you have a high Maximum Favourable Excursion (MFE) but a low Exit Accuracy, as your graph shows, then it is a sign that your strategy or your risk/money management is not adequate to capture it.
Scaling out is an option but the the most commonly used method to counter it, is the use of a trailing stop. Implement a trailing stop method that fits your strategy and your risk requirements.
If you wish, combine both the scaling out and the trailing stop. Experiment and see which combination of is best for your strategy.
I understand the risk/MM can influence the MFE of course (increasing or decreasing it). The strategy can be more adequate to capture the "MFE", fine, but I don't see how the risk/MM could help to "capture" the MFE. Unless I misunderstood you ?
I believe you'll have to run the back test again and more detailed this time.
First off, start testing your algo without any sort of stops so no target price nor stop loss nor trailing stop. This will allow you to acquire an actual MFE and MAE of your model in the past X years which I recommend X to be greater than 10, but due to each broker's circumstance of available historical data just make sure that your model trades enough to make your stats significant.
Next, optimization for a target price and a stop loss, find a cluster of MAE that is below zero line and negative; any point below that cluster is determined, generally, as a good area for setting your stop (shown on X-axis in points), but make sure to not set it in such a way that it interferes with your sell logic e.g. your model has a cluster of negative and positive MAE of around 100-200 points due to a sell logic and mostly negative MAE beyond 200 points so you should set your stop anywhere above or equal to 200 points.
As for the target price, find a cluster of MFE that is above zero line and positive; any point beyond that cluster that it starts to drop in a parabolic-like shape is usually determined, generally, as a good area for setting your target (show on X-axis in points), but, again, make sure to not set it in such a way that it interferes with your sell logic e.g. your model has a cluster of positive and negative MFE that of around 100-200 points and MFE starts dropping around 250 points so 200-250 point range is a good zone for setting your target price.
Remember, once you incorporate these stops into your model then it's a whole new model, so you'll have to run a new test again.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm having some large discrepancies between strategy tester and live trading (shocker). I recall looking through the backtest and forward test results after optimizations and my MFE was always very good, i left little on the table I was content.
However after running my latest test it would seem I'm leaving basically all of the money on the table, has anyone had this issue before? any possible solutions? (i was thinking scale out x% after y% in profit)
I always let my algo's run fully automated and do their thing but It's sure tempting to start intervening manually after seeing these stats...