EMA256 Fourier Cycle Trader
- Experts
-
Paolo Ruffini
Sono un trader con oltre 15 anni di esperienza operativa sui mercati Forex e materie prime, con particolare focus su dinamiche di liquidità, pressione volumetrica e struttura del movimento direzionale. - Versione: 2.0
- Attivazioni: 10
EMA256 Fourier Cycle Trader
EMA256 Fourier Cycle Trader is an advanced MetaTrader 5 Expert Advisor combining a long-term EMA or TEMA trend model, causal Fourier cycle analysis, configurable averaging and a unified basket take-profit system.
The Expert Advisor is designed primarily for CENT accounts and for traders who understand basket recovery strategies, geometric lot progression and the risks associated with trading without a mandatory Stop Loss.
RECOMMENDED STARTING CONFIGURATION
Recommended account type: CENT account
Recommended minimum actual deposit: USD 1,000
Recommended initial lot: 0.01 for every USD 1,000 of actual deposited capital
Recommended execution chart for XAUUSD: M5
Recommended internal signal timeframe: H1
Preferred account mode: Hedging
Recommended testing model: Every tick based on real ticks
Examples of the suggested starting ratio:
-
USD 1,000 actual deposit: 0.01 initial lot
-
USD 2,000 actual deposit: 0.02 initial lot
-
USD 3,000 actual deposit: 0.03 initial lot
This is a starting guideline and not a guarantee against drawdown, margin call or account loss.
CENT ACCOUNT INFORMATION
EMA256 Fourier Cycle Trader is primarily intended for CENT accounts because these accounts normally provide smaller effective exposure and greater flexibility when managing multi-position baskets.
A USD 1,000 deposit may appear in MetaTrader as approximately 100,000 cents, depending on the broker. The exact account currency name, balance representation, contract size, minimum volume, tick value, margin calculation and swap conditions are determined by each broker.
The recommendation of 0.01 lot per USD 1,000 always refers to the actual deposited capital, not necessarily to the numerical balance displayed by the terminal.
For example:
-
Actual deposited capital: USD 1,000
-
Possible CENT account display: 100,000 USC or 100,000 cents
-
Recommended initial lot: 0.01
If Balance-Scaled Lot Sizing is enabled, the Reference Balance must be entered using the balance units displayed by MetaTrader. On a CENT account showing 100,000 cents for a USD 1,000 deposit, the Reference Balance should normally be set to 100,000 rather than 1,000.
CENT account specifications are not standardized. Users must verify the exact contract size and effective exposure of 0.01 lot with their broker before starting the Expert Advisor.
Using the same 0.01 lot on a standard account may create substantially greater effective exposure. Standard-account users may therefore require significantly more capital.
TRADING MODEL
The trading model separates market prices into two main components:
-
A relatively stable trend component.
-
A cyclical residual component.
The stable component is calculated from logarithmic closing prices using either an Exponential Moving Average or a Triple Exponential Moving Average.
The default trend length is 256 completed bars.
Using logarithmic prices allows the model to evaluate proportional market movements more consistently across different price levels.
After calculating the EMA or TEMA trend, the Expert Advisor subtracts it from the logarithmic closing price. The resulting residual represents the shorter-term oscillations around the main trend.
A causal Fourier analysis is then applied to this residual.
FOURIER CYCLE ANALYSIS
The Expert Advisor searches for dominant cycles inside a configurable period range. It evaluates the spectral power of each candidate period and selects the strongest separated components.
The default model uses:
-
256 bars for spectral analysis
-
minimum cycle period of 8 bars
-
maximum cycle period of 64 bars
-
3 Fourier components
-
Hann window for spectral leakage reduction
-
recalculation every 8 signal bars
The Fourier fit is calculated exclusively from completed historical bars. Future information is not used in the calculation.
The Expert Advisor evaluates:
-
dominant cycle period;
-
spectral strength;
-
stability across consecutive recalculations;
-
projected direction of the residual;
-
projected percentage movement;
-
direction and slope of the EMA or TEMA trend.
An initial position is opened only when the enabled conditions agree.
A long signal normally requires:
-
an upward EMA or TEMA trend;
-
a stable dominant cycle;
-
sufficient spectral strength;
-
a positive Fourier forecast above the configured threshold;
-
acceptable spread, volatility, weekday and trading-session conditions.
A short signal normally requires the equivalent opposite conditions.
Users can independently enable or disable long and short positions.
EMA AND TEMA SELECTION
The Trend Model input allows the user to select:
EMA
The Exponential Moving Average produces a smoother and more stable long-term trend component. It is the original model used during development and is the default choice.
TEMA
The Triple Exponential Moving Average reacts faster to changes in market direction and reduces part of the lag associated with a traditional EMA.
TEMA can produce different entry timing and must be tested separately. Results obtained with EMA should not be assumed to apply automatically to TEMA.
INITIAL ENTRY LOGIC
The first position of every basket is opened only after a valid EMA/TEMA and Fourier signal.
The EA does not open an initial position simply because price has moved by a fixed amount. The complete signal logic must be satisfied.
Only one active basket per symbol and Magic Number is managed by each EA instance.
The EA can be attached to different charts, provided that every independent instance uses a different Magic Number.
AVERAGING LOGIC
When the market moves against an existing basket, the Expert Advisor may open an additional averaging position.
A new averaging order can require:
-
a minimum adverse price movement;
-
a new completed signal bar;
-
a minimum number of bars since the previous layer;
-
continued trend agreement;
-
renewed Fourier cycle confirmation;
-
acceptable spread;
-
acceptable ATR volatility;
-
sufficient free margin;
-
acceptable projected margin level;
-
compliance with the configured lot and basket limits.
The Expert Advisor does not automatically open all levels at fixed intervals. When cycle confirmation is enabled, the minimum distance must first be reached and the Fourier model must subsequently approve the new layer.
This means that the actual distance between averaging positions may be greater than the configured minimum.
AVERAGING DISTANCE MODES
Three averaging-distance modes are available.
Fixed Percent
The next layer is considered after price moves against the latest entry by the configured percentage.
ATR
The distance is calculated from the Average True Range and converted into a percentage of the current price.
Maximum of Percent and ATR
The EA uses the larger value between the fixed-percentage distance and the ATR-based distance.
The hybrid mode is the commercial default because it can automatically widen the grid during periods of increased volatility.
STEP EXPANSION
Step Expansion Per Level can progressively increase the required averaging distance.
For example, with an initial step of 1.00% and an expansion factor of 1.15:
-
first averaging distance: 1.00%
-
second averaging distance: 1.15%
-
third averaging distance: approximately 1.32%
-
fourth averaging distance: approximately 1.52%
This function can reduce the concentration of orders during a strong directional movement.
LOT PROGRESSION
The lot size of each layer is calculated as:
Initial Lot × Lot Multiplier raised to the layer index
Example with an initial lot of 0.01 and multiplier 2.00:
-
Initial entry: 0.01
-
First average: 0.02
-
Second average: 0.04
-
Third average: 0.08
-
Fourth average: 0.16
-
Fifth average: 0.32
-
Sixth average: 0.64
The combined exposure after these seven levels is 1.27 lots.
If another level is opened, the next order would be 1.28 lots and the combined basket exposure would become 2.55 lots.
This geometric progression is commonly described as Martingale-style position sizing. Exposure increases exponentially and can become extremely large.
The commercial default uses a more moderate 1.50 multiplier and configurable limits. A multiplier of 2.00 with unlimited averaging remains available for experienced users but is classified as an aggressive configuration.
POSITION-SIZING MODES
Fixed Lot
The first position always uses the configured Initial Lot.
Balance-Scaled Lot
The initial lot is automatically scaled according to the current balance and Reference Balance.
For CENT accounts, the Reference Balance must be entered in the account units displayed by MetaTrader.
Fixed Lot is recommended for initial testing because it is easier to understand and verify.
CONFIGURABLE EXPOSURE LIMITS
The Expert Advisor includes optional limits for:
-
maximum number of averaging orders;
-
maximum size of one order;
-
maximum combined basket volume;
-
minimum projected margin level;
-
free-margin reserve.
Setting Maximum Averaging Orders to zero enables unlimited averaging.
Setting Maximum Single Order Lot to zero uses the broker’s maximum permitted volume.
Setting Maximum Basket Lots to zero removes the basket-volume limit.
These controls only prevent additional entries. They do not close an existing basket and are not Stop Loss functions.
UNIFIED BASKET TAKE PROFIT
All positions belonging to the current symbol and Magic Number are managed as one basket.
In Weighted Price mode, the Expert Advisor calculates the volume-weighted average entry price:
Sum of each entry price multiplied by its volume, divided by total basket volume.
A single target is then calculated from this weighted average.
The same Take Profit is assigned to every position in the basket whenever broker conditions permit it.
When the common target is reached, the Expert Advisor closes the complete basket.
Some older positions may close with an individual loss while newer positions close with a larger individual profit. This is normal basket behavior.
The purpose of the unified target is to close the combined basket according to its aggregate recovery objective. It does not require every individual position to be profitable.
BASKET TARGET MODES
Weighted Price Target
The target is calculated as a percentage above or below the volume-weighted average basket entry.
Account Money Target
The basket is closed when its floating result reaches a configurable amount expressed in the account currency units displayed by MetaTrader.
On CENT accounts, money values may be interpreted as cents rather than dollars. Users must confirm how their broker displays the account currency before using money-based targets.
ADAPTIVE BASKET TARGET
The Expert Advisor can optionally reduce the percentage target as the number of averaging positions increases.
This function is controlled through:
-
Reduce Target After Averaging;
-
Target Reduction per Average;
-
Minimum Basket Target Percent.
The adaptive target can reduce the recovery movement required by a deep basket. It is disabled by default and must be tested before use.
SERVER-SIDE AND SOFTWARE TARGET CONTROL
In Weighted Price mode, the EA can place the common target directly on every position as a server-side Take Profit.
The EA also monitors the target in software.
If the broker temporarily rejects a target because of stop-level or freeze-level restrictions, the software monitoring remains active and can close the basket when the intended price is reached.
OPTIONAL BASKET PROFIT TRAILING
The Expert Advisor includes an optional profit-only trailing system for the entire basket.
The trailing system is activated only after the floating basket result reaches Trailing Start Money.
It then monitors the highest observed basket result and attempts to protect a positive amount according to:
-
Trailing Start Money;
-
Trailing Lock Money;
-
Trailing Distance Money.
This is not a traditional Stop Loss. It is designed to manage an already positive basket result.
The basket profit trailing is disabled by default.
NO MANDATORY STOP LOSS
EMA256 Fourier Cycle Trader does not use a mandatory Stop Loss in its original strategy.
The EA also does not close a losing basket because an opposite Fourier signal appears.
A basket can therefore remain open in floating loss for an extended period while waiting for averaging opportunities and a subsequent retracement.
Depending on market conditions, a basket may remain open for days, weeks or months.
The absence of a Stop Loss does not eliminate risk. It transfers the risk to floating drawdown, margin consumption and basket duration.
VOLATILITY FILTERS
Separate ATR limits can be configured for:
-
initial entries;
-
averaging entries.
A value of zero disables the corresponding ATR filter.
Users may allow an existing basket to continue its recovery logic while preventing new initial positions during abnormal volatility.
TIME AND WEEKDAY FILTERS
The EA includes:
-
server-time trading-session filter;
-
start hour;
-
end hour;
-
overnight-session support;
-
independent Monday-to-Friday switches;
-
optional application of the time filter to averaging positions.
By default, time filters apply to initial entries. Users may decide whether recovery orders should remain active outside the normal entry session.
SPREAD FILTER
The Maximum Spread Points input blocks new entries when the current spread exceeds the configured value.
A separate switch determines whether the spread filter also applies to averaging orders.
Spread points depend on the number of digits used by the broker. The same numerical value can represent different price distances on different symbols.
MARGIN AND EXECUTION CHECKS
Before sending an order, the Expert Advisor verifies:
-
terminal connection;
-
Algo Trading permission;
-
account trading permission;
-
symbol trading mode;
-
broker minimum and maximum volume;
-
broker volume step;
-
required margin;
-
available free margin;
-
configured free-margin reserve;
-
optional projected margin level;
-
maximum order and basket-volume limits.
These checks reduce invalid trade requests but cannot guarantee execution or prevent future drawdown.
HEDGING AND NETTING ACCOUNTS
The Expert Advisor supports both hedging and netting account modes.
Hedging accounts are preferred because every averaging layer remains visible as a separate position.
On netting accounts, positions of the same symbol are combined by MetaTrader. The EA reconstructs the number of basket layers from trade history.
On a netting account, users should not combine:
-
manual trades;
-
another Expert Advisor;
-
another Magic Number;
on the same symbol, because MetaTrader maintains a single net position for that symbol.
CHART INFORMATION PANEL
The optional chart panel displays:
-
internal signal timeframe;
-
selected EMA or TEMA model;
-
dominant Fourier cycle;
-
spectral strength;
-
number of stable fits;
-
current trend movement;
-
Fourier forecast percentage;
-
number of positions;
-
number of basket layers;
-
total basket lots;
-
floating basket result;
-
current basket target;
-
calculated next lot.
The panel can be disabled if the user prefers a clean chart.
RECOMMENDED COMMERCIAL PROFILE
The supplied recommended profile uses:
-
CENT account;
-
recommended minimum actual deposit of USD 1,000;
-
initial lot 0.01;
-
EMA trend model;
-
H1 signal timeframe;
-
256-bar trend;
-
256-bar Fourier window;
-
multiplier 1.50;
-
maximum six averaging orders;
-
maximum single order of 0.20 lot;
-
maximum basket volume of 0.50 lot;
-
projected margin-level control;
-
10% free-margin reserve;
-
hybrid percentage/ATR spacing;
-
progressive step expansion;
-
unified 1.00% weighted-price basket target;
-
cycle and trend confirmation for averaging;
-
no mandatory Stop Loss.
These settings are intended as a starting point for testing. They are not universal settings for every broker or symbol.
AGGRESSIVE X2 PROFILE
An additional research profile is supplied with:
-
initial lot 0.01;
-
multiplier 2.00;
-
unlimited averaging;
-
fixed 1.00% averaging distance;
-
1.50% weighted-price basket target;
-
no maximum order-volume limit;
-
no maximum basket-volume limit;
-
no mandatory Stop Loss.
This configuration has unbounded geometric progression risk and is not recommended as the first live setup.
RECOMMENDED TESTING PROCEDURE
Before using real funds:
-
Verify the broker’s CENT account specifications.
-
Confirm the effective exposure of 0.01 lot.
-
Run the Strategy Tester using Every tick based on real ticks.
-
Include the broker’s spread, commission and swap.
-
Test both rising and falling market periods.
-
Use a historical period long enough to include multiple volatility regimes.
-
Reserve at least 30% to 40% of the available data for forward testing.
-
Review equity drawdown rather than only balance drawdown.
-
Record the maximum number of basket layers.
-
Record the maximum combined basket volume.
-
Record the longest basket duration.
-
Repeat the test with Lot Multiplier 1.00 to evaluate the underlying EMA/Fourier signal without geometric progression.
-
Run the final configuration on a CENT demo account before live trading.
RISK DISCLOSURE
EMA256 Fourier Cycle Trader can use averaging, grid-style entries and geometric lot progression without a mandatory Stop Loss.
These techniques can create substantial floating losses and rapidly increasing exposure. A persistent directional movement without a sufficient retracement can lead to margin call, forced liquidation or complete loss of the trading capital.
A high percentage of profitable baskets does not guarantee long-term profitability. Losing baskets may remain unrealized for extended periods when no Stop Loss is used.
The recommended minimum of USD 1,000 and the ratio of 0.01 initial lot per USD 1,000 are starting guidelines only. They do not guarantee that the account will survive every market condition.
Historical backtests, optimization results and demo performance do not guarantee future results. Every user is responsible for selecting settings appropriate to the broker, symbol, leverage, contract size and personal risk tolerance.
