Exp_XWAMI_NN3_MMRec - MetaTrader 5 Expert - MT4/MT5 Resources


Added Expert Advisor input block for managing the number of open positions. For example, for the first system:
Input unit A_BuyTotalMMTriger= 5 ; //The quantity of the last buy transaction to calculate the stop loss Input unit A_BuyLossMMTriger= 3 ; //Some losing Buy transactions reduce MM Input unit A_SellTotalMMTriger= 5 ; //The quantity of the last sell transaction to calculate stop loss Input unit A_SellLossMMTriger= 3 ; //Some losing Sell transactions to reduce MM Enter double A_small MM= 0.01 ; //Margin share in a transaction to prevent loss Enter double A_MM= 0.1 ; //The share of margin in a transaction during normal trading Enter margin mode A_MMMode=LOT; //Many setting modes
In the case of such inputs, when choosing from the last 5 trades (3 of which were losses in a single direction), the EA opens the next trade in the same direction with a volume of 0.01 lots. If the last 5 losing trades are less than 3, the position will be 0.1.
Similar inputs can be used for the second trading system:
Input unit B_BuyTotalMMTriger= 5 ; //B The quantity of the last buy transaction to calculate the stop loss Input unit B_BuyLossMMTriger= 3 ; //B loss buying transaction quantity to reduce MM Input unit B_SellTotalMMTriger= 5 ; //B The quantity of the last sell transaction is used to calculate the stop loss Input unit B_SellLossMMTriger= 3 ; //B loss selling transaction quantity to reduce MM Enter double B_SmallMM= 0.01 ; // B-share margin in a transaction to prevent loss Enter double B_MM= 0.1 ; //B shares deposited in one transaction during normal trading
The C_ prefix is used for input to the third system.
The best option for setting up such an EA is to configure it individually on each trading system and apply appropriate switches to disable the other two systems in the form of the following parameters:
Enter a Boolean value B_BuyPosOpen= true ; //B allows entry into long positions Enter a Boolean value B_SellPosOpen= true ; //B allows short positions to be opened
By setting them to false.
In order for the generated EA to run correctly, the compiled XWAMI.ex5 indicator file should be available in the <terminal data directory>\MQL5\indicators folder.
The default Expert Advisor input parameters with stop loss were used during the test as shown below.

Figure 1. Example of trade on chart
2016 GBPJPY H1, H4 and H8 test results.

Figure 2. Test result graph
Attachment download
📎Exp_XWAMI_NN3_MMRec.mq5 (56.82 KB)
📎 SmoothAlgorithms.mqh (130.2 KB)
📎 TradeAlgorithms.mqh (236.36 KB)
📎 XWAMI.mq5 (18.07 KB)
Source: MQL5 #21660
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •