Meet the Creator: Scriptor
MQL5 Code Contributor: barabashkakvn
The Breadandbutter2 is an expert advisor (EA) designed for MetaTrader 5 that leverages the iADX (Average Directional Movement Index) and iAMA (Adaptive Moving Average) indicators. This EA kicks into gear when a new bar forms, and it smartly closes any opposing positions upon receiving a trading signal.
Finding the Optimal Parameters
When it comes to tuning the parameters for your specific currency pair and timeframe, you have two avenues:
- Manual Tuning: You can adjust the "<" and ">" operators in the signal equations:
if(adx_0<adx_1 && ama_0>ama_1) { ClosePositions(POSITION_TYPE_SELL); double sl=(InpStopLoss==0)?0.0:m_symbol.Ask()-ExtStopLoss; if(sl>=m_symbol.Bid()) // incident: the position isn't opened yet, and has to be already closed { PrevBars=0; return; } double tp=(InpTakeProfit==0)?0.0:m_symbol.Ask()+ExtTakeProfit; OpenBuy(sl,tp); return; } if(adx_0>adx_1 && ama_0<ama_1) { ClosePositions(POSITION_TYPE_BUY); double sl=(InpStopLoss==0)?0.0:m_symbol.Bid()+ExtStopLoss; if(sl<=m_symbol.Ask()) // incident: the position isn't opened yet, and has to be already closed { PrevBars=0; return; } double tp=(InpTakeProfit==0)?0.0:m_symbol.Bid()-ExtTakeProfit; OpenSell(sl,tp); return; }
- Automatic Tuning: This method allows the EA to automatically select the stop loss, take profit, and the horizontal shift for the AMA indicator.

Related Posts
- Creating an Expert Advisor for Dark Cloud Cover and Piercing Line Patterns with CCI Confirmation
- Harnessing MQL5 Wizard for Trading Signals: 3 Black Crows & 3 White Soldiers with MFI
- Unlock Trading Insights with the Support Vector Machine Learning Tool for MetaTrader 5
- Creating a Stochastic-Based EA for Hammer and Hanging Man Patterns in MetaTrader 5
- Mastering Trading Signals with MQL5 Wizard: Bullish and Bearish Engulfing Strategies