Toba
- Experts
- Johan Gerard W Martens
- Versione: 1.0
- Attivazioni: 5
The Toba EA is a multi-timeframe trading system that uses a combination of trend-following and momentum indicators to identify trade opportunities. It incorporates robust risk management features, including break-even, trailing stops, and configurable risk parameters. The EA is specifically designed to trade on the Silver (XAG) symbol and ensures that trades align with both higher and lower timeframe trends.
1.1 Safety First!
We added risk management features, which are:
- Risk: You can only add a risk level between 0% and 2% on the running equity, and this per trade. In case your trade goes south, and the risk level is reached, the trade will be closed.
- Emergency stop: Your broker may impose you a maximum drawdown of e.g. $500 per trade. You may want to set this value then to $450 just to have a buffer in case your trade is not filled immediately.
- Anti Revenge and Greed: To prevent you are going to use excessive lot sizes, you cannot set your lot size higher than 5.0.
1.2 What is covered by the Toba advisor?
This Expert Advisor (EA) named Toba is a trading system designed for MetaTrader 5 and works only for Silver (XAGUSD).It uses multiple indicators to determine trade entries, exits, and risk management.
1.2.1 Indicators Used:
a) Moving Averages (MA):
- Fast, Middle, and Slow MAs on lower and middle timeframes.
- Fast and Slow MAs on higher timeframes.
b) Bollinger Bands (BB):
- Used for defining Stoploss.
c) RSI (Relative Strength Index):
- Fast and Slow RSI values for momentum analysis.
d) MACD (Moving Average Convergence Divergence):
- Used for trend confirmation.
e) ATR (Average True Range):
- Used for setting take-profit levels.
f) Aroon Indicator:
- Used to detect trends and reversals.
1.2.2 Timeframes:
The EA uses multiple timeframes:
- Lower Timeframe: Default is M15 (15 minutes).
- Middle Timeframe: Default is H1 (1-hour).
- Higher Timeframe: Default is H4 (4-hours).
1.2.3 Risk Management:
- Configurable lot size, risk percentage, and maximum drawdown.
- Implements stoploss & trailing stop mechanisms.
1.3 Key features for trading with the expert advisor
1.3.1 Input Parameters
The EA has several configurable inputs:
- General Settings:
Indicate Lot Size:
Ensure alignment with your broker's settings for the minimum lot size value. This expert advisor will attempt to recalculate the lot size based on your risk preferences, in case you are not using fixed lot sizes. It will not calculate a larger lot size than what the broker permits.
Indicate Fixed Lot size:
If defined true, it will not use dynamic lot sizes
Indicate Risk % ([0,2]):
Risk is measured against running equity, with acceptable values ranging from 0 to 2. For safety, values above 2 are not permitted. Risk is calculated per trade.
Indicate Maximum Drawdown, 0 means NA:
You can set a monetary value here, which will serve as an emergency stop. The maximum drawdown is per trade. If the value is set to 0, this parameter will be ignored.
- Defining the timeframes for the lower, middle and higher timeframes
- Moving Average Settings for Lower Timeframe:
- Timeframe, Period, method, and applied price for fast, middle, and slow MAs.
- Moving Average Settings for Middle Timeframe:
- Timeframe, Period, method, and applied price for fast, middle, and slow MAs.
- Moving Average Settings for Higher Timeframe:
- Timeframe, Period, method, and applied price for fast, and slow MAs.
5. Bollinger Bands Settings:
- Timeframe, period, deviation and applied price.
Go to Inputs – tab of the expert advisor where you can adapt some parameters by double clicking on them.
1.3.2 Initialization (OnInit)
- Ensures the EA runs only on the Silver (XAG) symbol.
- Initializes all indicators and their handles.
- Sets up Bollinger Bands, MACD, RSI, ATR, and Moving Averages.
- Configures the Aroon indicator for trend detection. You can get it at the MQL5 codebase library: Free download of the 'AROON' indicator. Without this indicator, the expert advisor will not work.
1.3.3 Trade Entry Logic
The method used for this EA is the Puria-method combined with a mixture of settings on Bollinger Band, RSI and ATR. The core of this EA works on the H1 (Middle timeframe) and goes as follows:
- Indicators Used
- Three Moving Averages (MA):
- Two red MAs (periods 75 & 85) based on low prices
- One orange MA (period 8) based on close prices
- MACD (Moving Average Convergence Divergence) for confirmation
- Buy Signal
- The orange MA (8) crosses upward through both red MAs
- MACD histogram shows a bar above zero
- Sell Signal
- The orange MA (8) crosses downward through both red MAs
- MACD histogram shows a bar below zero
1.3.4 Trade Exit Logic
- Trades are closed under the following conditions:
- Maximum drawdown is exceeded.
- Risk level in monetary terms is exceeded.
- Profit is achieved, and specific conditions are met (e.g., trailing stop is triggered).
- Stoploss has been hit.
1.3.5 Trailing Stop
- Trailing Stop:
- Adjusts the stop-loss when the profit has reached 5%. Value is set at 4-times the ATR.
1.4 Risk Management
- Calculates lot size based on risk percentage and stop-loss distance.
- Ensures the lot size is within the broker's allowed range.
- Prevents trades if free margin is insufficient.
1.5 Testing Results
You can see the settings and result on the attached images. The test data used for this EA where downloaded from https://strategyquant.com/quantdatamanager.