Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Currency Fixed Risk - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 7 reads | 0 comments |

Money Fixed Risk - expert for MetaTrader 5

Money Fixed Risk - expert for MetaTrader 5

Money Fixed Risk - expert for MetaTrader 5

Money Fixed Risk - expert for MetaTrader 5

Money Fixed Risk - expert for MetaTrader 5

Money Fixed Risk - expert for MetaTrader 5

Money Fixed Risk - expert for MetaTrader 5

Example of calculating lot size based on risk per trade.

Update : December 28, 2016 -> Version 1.001

Added two methods for outputting (printing) calculated batches. Method 1 — when setting stop loss to zero.

Method 2 — See the code listing below:

Also, now check the results of the trading operation:

First check : If the end buy method operation returns "true", but the result trade() method returns "0" (this can happen in case of re-referencing) - the "count" counter should be decremented by one.

Second check : If the end buy method returns false "false", the "count" counter should be decremented by one.

Why do we need to decrement the "count" by one? In this case we don't have to wait for 980 ticks again, but we can try to enter on the next tick.

How it works:

Set the risk percentage ( % risk parameter) and stop loss ( Stop Loss (in pips) range) for each trade. This defines the parameters of possible deposit losses.

Money Fixed Risk - expert for MetaTrader 5

Implement the following loop to simulate trading:

Initial value count = - 21 is set to "warm up" the strategy tester. Then the remainder after division is calculated through 980 (this number is randomly selected). This means that every 980 pips the lot calculation period starts where the lot calculation takes into account the risk of each trade.

The lot calculation period depends on the risk of each trade (calculation of buy positions):

Then, the calculated lot size of the long position (taking into account the stop loss) will be received to check the open long position variable using the method of checking the open long position CMoney fixed risk class:

The following parameters are printed to the expert journal : Stop loss, lot calculation based on risk per trade, trading account balance at the time of calculation, margin at the time of calculation.

If the calculation returns "0.0", exit:

Then we receive the lot size of the long position for which we have sufficient funds; this value is received into the chek_volime_lot variable of the TradeNet class using the CheckVolume method. The following parameters are passed here: m_symbol.Name() — symbol name, check open long lot size — the amount of the position we want to open (this parameter was calculated before):

If the value returned by the CheckVolume method is not "0.0", then we check the condition: whether we have enough funds to open the position, the lot size is calculated according to the risk.

If we have sufficient funds, a position is opened, if not - the lot value calculated based on the risk of each trade ( double to string (check_volime_lot, 2 ) ) and the lot value for which we have sufficient funds ( double to string (chek_volime_lot, 2 ) ) are printed to the expert journal.

Example (when testing in the strategy tester, select EURUSD, M1, test period starts on November 28, 2016, deposit $3000):

Money Fixed Risk - expert for MetaTrader 5

Buy position opened (excerpt from test log) - lot size calculated based on risk per trade is 2.23.

It turned out that there was not enough funds to open a second position.

Please note that when StopLoss is not specified (StopLoss=0.0), the calculated lot size is equal to the minimum allowed lot value.

As a result, the first position was stopped and closed with a loss of 298.82:

Money Fixed Risk - expert for MetaTrader 5

This amounts to almost 10% risk on a $3,000 deposit.


Attachment download

📎 money_fixed_risk.mq5 (9.97 KB)

Source: MQL5 #17199

Currency Fixed Risk - MetaTrader 5 Expert Pre-Use Tips

This page has been supplemented with structured instructions, focusing on the purpose of EA source code, MQL4/MQL5 platform compatibility, testing process and risk control. Before downloading or deploying, it is recommended to first determine whether it is consistent with your own variety, cycle and account environment.

Suitable for who to use

  • Users who want to quickly screen EA source code and are willing to do simulation disk verification first.
  • People who need to compare MT4/MT5 EAs, indicators, scripts or source code projects.
  • Traders who wish to record backtests, parameters and risk boundaries before placing a trade.

Testing and risk control suggestions

  • First verify the default parameters in the strategy tester or demo account, and then adjust the symbol, period, spread and trading period one by one.
  • Scalping, grid, martin, and high-frequency strategies should focus on observing maximum drawdowns, consecutive losses, slippage, and trading frequency.
  • It is not recommended to run any document directly on the real disk. At least observe the simulated disk performance for 2-4 weeks first.

FAQ

Can MT4 and MT5 be used interchangeably?
Usually cannot be used directly. EX4/MQ4 corresponds to MT4, EX5/MQ5 corresponds to MT5, and the source code needs to be compiled in the corresponding MetaEditor.

Is this resource guaranteed to be profitable?
cannot. EAs, indicators and scripts can only be used as trading tools, and the results depend on parameters, market environment, spreads, slippage and risk control.

What else can I continue to watch?
Forex EA download , foreign exchange indicator download , EA evaluation , MQL5 CodeBase .

English Search Notes

This page is also optimized for English search intent around Currency Fixed Risk - MetaTrader 5 Expert . Related search terms include: MQL4 source code, MQL5 source code. Test any Forex EA, Expert Advisor, MT4/MT5 indicator, script or MQL source code with historical data and a demo account before live trading.

Verification code Refresh