Allgain100
- Experts
- Nissar Ahmed
- Version: 1.0
- Activations: 5
Key Features
-
Strategy Core
-
EMA Crossover System:
-
Fast EMA (default: 20) and Slow EMA (default: 50)
-
Generates buy signals when Fast EMA crosses above Slow EMA.
-
Generates sell signals when Fast EMA crosses below Slow EMA.
-
-
Fibonacci Filter:
-
Calculates Fibonacci retrenchment levels (23.6%, 38.2%, 50%, 61.8%, 78.6%) based on recent price swings.
-
Requires price to be near a Fibonacci level (configurable threshold) to validate trades.
-
-
-
Risk Management
-
Position Sizing: Dynamically calculates lot size based on account balance and user-defined risk percentage.
-
Stop Loss & Take Profit: Fixed in pips, adjusted for 5-digit brokers.
-
Single Position Rule: Avoids multiple entries by allowing only one active trade at a time.
-
-
User Configuration
-
Toggle trading on/off ( Enable Trading ).
-
Adjust EMA periods, Fibonacci look back, and risk parameters.
-
Enable/disable Fibonacci filtering ( UseFibFilter ).
-
Input Parameters
Group | Parameter | Description |
---|---|---|
Strategy Settings | EnableTrading | Enable/disable trading |
MagicNumber | Unique identifier for EA trades | |
RiskPercentage | Risk per trade (% of account balance) | |
EMA Settings | FastEMA | Period for faster EMA (e.g., 20) |
SlowEMA | Period for slower EMA (e.g., 50) | |
Fibonacci Settings | FibLookback | Bars analyzed for swing high/low (e.g., 100) |
FibThreshold | Max distance (pips) from Fib level to trade | |
UseFibFilter | Enable Fibonacci validation | |
Trade Settings | StopLoss | Stop loss in pips (e.g., 100) |
TakeProfit | Take profit in pips (e.g., 50) |
Workflow
-
Initialization ( OnInit ):
-
Validates EMA periods (ensures Fast < Slow).
-
Initializes EMA indicators and calculates PointMultiplier for broker digit adjustment.
-
Sets magic number for trade identification.
-
-
Tick Processing ( OnTick ):
-
Signal Generation:
-
Checks EMA crossover conditions using the latest two bars.
-
-
Fibonacci Validation:
-
Identifies recent swing high/low over FibLookback bars.
-
Computes Fibonacci levels and checks proximity to current price.
-
-
Trade Execution:
-
Calculates stop loss ( sl ), take profit ( tp ), and lot size.
-
Executes buy/sell orders only if no existing positions.
-
-
-
Risk Management:
-
CalculateLotSize() : Uses account balance, risk percentage, and stop loss to determine position size.
-
Converts pips to points for SL/TP using PointMultiplier .
-
Example Trade
-
Buy Signal:
-
Fast EMA (20) crosses above Slow EMA (50).
-
Current price is within 0.5 pips of the 61.8% Fibonacci level.
-
Lot size = (1% of $10,000 account) / (100 pips SL * tick value).
-
Order: Buy 0.15 lots, SL = entry - 100 pips, TP = entry + 50 pips.
-
Notes
-
Broker Compatibility: Handles 4/5-digit brokers via PointMultiplier .
-
Limitations:
-
No trailing stop or recovery mechanism.
-
Single-position logic may miss opportunities in trending markets.
-
-
Optimization: Consider adding trend filters (e.g., RSI) or modifying Fibonacci calculation logic for different market conditions.
This EA provides a systematic approach to trading EMA crossovers with Fibonacci confirmation, emphasizing controlled risk and parameter flexibility. Test thoroughly in a demo environment before live deployment.