Bitcoin Martingal Moving Average
- Experts
- Version: 2.0
- Activations: 20
Send me a message so I can send you the setfile
Robust robot with several configurations available,
Use with BTC on a 10-minute timeframe with the settings in the screenshot below.
When purchasing the expert robot, you have the right to request modifications to continue improving the bot.
Key Features
-
Moving Average Crossover Strategy:
-
The EA uses two moving averages (MA1 and MA2) to generate trading signals.
-
A crossover of the faster MA (MA1) above or below the slower MA (MA2) triggers a trade.
-
-
Martingale Strategy:
-
If a trade results in a loss, the lot size for the next trade is increased by a multiplier ( martingaleMultiplier ).
-
The martingale sequence resets after a winning trade or when the maximum number of martingale steps ( maxMartingale ) is reached.
-
-
Risk Management:
-
Stop Loss (SL) and Take Profit (TP) levels are configurable.
-
Trailing Stop and Break Even functionality are included to lock in profits and minimize losses.
-
Daily Profit/Loss Limits: The EA stops trading if the daily profit or loss exceeds the specified limits.
-
-
Filters:
-
Volatility Filter: Uses ATR to ensure trades are only taken within a specified volatility range.
-
Time Filter: Restricts trading to specific hours and days of the week.
-
Trend Filter: Uses ADX to ensure trades are taken in the direction of the trend.
-
Volume Filter: Ensures trades are only taken if the trading volume meets a specified threshold.
-
RSI Filter: Uses RSI to avoid overbought/oversold conditions.
-
News Filter: Placeholder for integrating a news-based filter (not implemented in this script).
-
-
Money Management:
-
The lot size can be dynamically calculated based on a percentage of the account balance ( riskPercentage ).
-
-
Additional Features:
-
Close All Positions at Specific Time: Allows closing all positions at a specified time.
-
Close All Positions at End of Day: Automatically closes all positions at the end of the trading day.
-
Distance from Crossover Filter: Ensures trades are only taken if the price is within a specified distance from the crossover point.
-
Wait for Fast MA Touch: Ensures the price touches the fast MA before opening a trade.
-
Global Variables
-
lastTradeLot : Tracks the lot size for the next trade (used in the martingale strategy).
-
martingaleCount : Tracks the number of consecutive losses in the martingale sequence.
-
dailyProfit and dailyLoss : Track the daily profit and loss.
-
lastTradeDay : Tracks the last day a trade was executed.
-
lastCrossTime : Tracks the time of the last moving average crossover.
-
waitForClose : A flag to wait for the current trade to close before opening a new one.
Functions
-
Initialization ( OnInit ):
-
Initializes indicator handles (MA, RSI, ATR, ADX).
-
Checks for errors in indicator creation.
-
-
Filters:
-
CheckVolatilityFilter() : Ensures trades are only taken within a specified volatility range.
-
CheckTimeFilter() : Restricts trading to specific hours and days.
-
CheckTrendFilter() : Ensures trades are taken in the direction of the trend.
-
CheckVolumeFilter() : Ensures trades are only taken if the volume meets a threshold.
-
CheckNewsFilter() : Placeholder for a news-based filter.
-
CheckRSIFilter() : Ensures trades are only taken if RSI conditions are met.
-
-
Risk Management:
-
CheckDailyLimits() : Checks if daily profit or loss limits have been reached.
-
CheckStopLoss_Takeprofit() : Validates SL and TP levels.
-
CheckMoneyForTrade() : Ensures there is enough margin to open a trade.
-
-
Trade Execution:
-
OpenTrade() : Opens a trade based on the direction (buy/sell).
-
CloseCurrentTrade() : Closes the current trade and updates the martingale sequence.
-
CloseAllPositions() : Closes all open positions.
-
-
Trailing Stop and Break Even:
-
TrailingStop() : Adjusts the stop loss to lock in profits.
-
CheckBreakEven() : Moves the stop loss to the break-even point once a specified profit is reached.
-
-
Money Management:
-
CalculateLotSize() : Calculates the lot size based on the account balance and risk percentage.
-
-
Additional Filters:
-
CheckDistanceFromCross() : Ensures trades are only taken if the price is within a specified distance from the crossover point.
-
CheckPriceTouchFastMA() : Ensures the price touches the fast MA before opening a trade.
-
-
Time-Based Actions:
-
CheckCloseAllAtSpecificTime() : Closes all positions at a specified time.
-
CheckAndClosePositionsForDailyLimits() : Closes all positions if daily profit or loss limits are reached.
-
