TickWind

Strategy Overview
This is an MT5 Expert Advisor (EA) based on the high - frequency trading concept, with the file name HFT_Martingale_Final.mq5. The core of the strategy is to generate trading signals through continuous price fluctuations, combined with the Martingale (doubling bet) position - adding mechanism, and cooperate with risk - control measures such as trailing stop - profit, fixed stop - loss, daily profit and loss limits, and time - period control. The goal is to capture profits in trending markets while controlling risks in range - bound markets.
Main Strategy Logic
1. Signal Generation

Price Fluctuation Counting: Continuously monitor the number of consecutive up/down movements of the current price (the default is 3 consecutive movements in the same direction).
Trigger Conditions: When the number of consecutive up movements reaches the threshold → generate a buy signal; when the number of consecutive down movements reaches the threshold → generate a sell signal.
Candlestick Direction Filter: It can be set to only allow trades in the same direction as the current candlestick (e.g., only go long on bullish candlesticks).

2. Order Execution

Lot Size Calculation: The base lot size is calculated as a proportion of the account balance (e.g., trade 0.01 lots for every $1000 in the account), and then multiplied by the doubling - bet multiplier (default 1.5 times) to get the final lot size.
Order Type: Open orders at the market price directly. Delayed orders can be set (e.g., execute the order 30 seconds after the signal appears).
Trade Limit per Candlestick: By default, a maximum of 2 trades per candlestick are allowed, with a maximum of 1 trade in each direction.

3. Risk - Control Module
① Fixed Stop - Loss and Take - Profit

Stop - Loss Points: The default is 300 points.
Take - Profit Points: The default is 900 points.
The stop - loss and take - profit prices are set at the time of order opening.

② Trailing Stop - Profit

Enable Status: Enabled by default.
Logic: When the profit exceeds a specified distance (default 10 points), move the stop - loss to the current price minus this distance to lock in profits.

③ Spread Control
If the current spread exceeds the maximum allowed value (default 15 points), order opening will be rejected.
④ Maximum Position Limit
By default, a maximum of 21 orders (including both long and short positions) can be held simultaneously to prevent over - exposure.
⑤ Daily Profit and Loss Limits

Daily Profit Cap: 5% (when reached, close all positions and stop trading).
Daily Loss Cap: 30% (when reached, close all positions and stop trading).
Daily Automatic Reset: Profits and losses are recalculated at the start of a new day.

⑥ Trading Time - Period Control

Trading Time Range: The start and end times of trading can be set (e.g., from 00:30 to 23:30).
End - of - Day Closing Function: All positions are automatically closed at a specified time (e.g., 23:50).

⑦ Candlestick Period Control
The candlestick period for trading reference can be freely selected (the default is M5).
4. Martingale (Doubling Bet) Position - Adding Mechanism

Independent Doubling Bet for Long and Short: Enabled by default, which means that losses on long orders do not affect the doubling - bet level of short orders.
Logic: When an order is closed at a loss, the doubling - bet level in that direction increases by 1, and the next trade in the same direction will immediately execute a doubling - bet order (the lot size is multiplied by the lot size of the previous level × 1.5).
Reset on Profit: Once a position in a certain direction is closed at a profit, the doubling - bet level is reset to zero.
Maximum Level Limit: The default maximum is 5 levels to prevent out - of - control positions.

Adjustable Parameters (Input Parameters)



Parameter Name
Default Value
Description




InpConsecutiveThreshold
3
Trigger a signal when the number of consecutive fluctuations reaches this value


InpStopLoss / InpTakeProfit
300 / 900
Fixed stop - loss/take - profit points


InpMaxSpreadPoints
15
Maximum allowed spread


InpBarTradeLimit
2
Maximum number of trades per candlestick


InpMaxPositions
21
Maximum number of simultaneous positions


UseTrailingStop / TrailingStopDistance
true / 10
Trailing stop - profit switch and distance


UseMartingale / MartingaleMultiplier
true / 1.5
Doubling - bet switch and multiplier


MaxMartingaleLevels
5
Maximum doubling - bet levels


SeparateMartingale
true
Whether to use independent doubling bets for long and short


EnableDailyLimits / DailyProfitLimit / DailyLossLimit
true / 5% / 30%
Daily profit and loss limits


EnableTimeControl / TradingPeriodStart/End
true / "00:30" - "23:30"
Trading time - period


EnableEndOfDayClose / EndOfDayCloseTime
true / "23:50"
End - of - day closing


UseDelayedOrders / DelayedOrderDelay
true / 30 seconds
Delayed order switch and delay time



Strategy Application Scenarios and Precautions

Applicable Instruments: Currency pairs with relatively frequent fluctuations and good trending characteristics (e.g., EURUSD, GBPUSD, etc.).
Applicable Timeframes: M5 - M15 are more suitable. Too long a timeframe may result in too few signals.
Risk Warnings:

The Martingale strategy can significantly increase the position size during consecutive losses, which may lead to large drawdowns.
The 30% daily hard stop - loss is the last line of defense, but slippage may cause the actual loss to exceed the set value.
It is recommended to fully test the strategy on a demo account first, optimize the parameters, and then consider live trading.



Summary
This is a highly integrated high - frequency trading EA that combines trend - following, Martingale position - adding, and multiple risk - control modules. The advantages are high flexibility and a rich set of parameters, which can be adjusted according to different market environments. The disadvantage is that the strategy is complex and requires users to have a deep understanding of the parameters. It is recommended that users back - test the strategy in the strategy tester and adjust it to a reasonable profit - to - loss ratio and maximum drawdown level based on historical data.

Filtrele:
Değerlendirme yok
Değerlendirmeye yanıt