8.1
FX Moving Average HP Filter
PYTHON PLUGIN
Fx
Trend
Description
Strategy 8.1: HP-filtered MA crossover on FX spot rates
Strategy Logic
Strategy 8.1: Moving averages with Hodrick-Prescott filter.
Apply HP filter to smooth FX spot rate, then compute two moving averages
on the smoothed series. MA(T1) > MA(T2) signals buy; MA(T1) < MA(T2)
signals sell. The HP filter minimises
sum(S - S*)^2 + lambda * sum( S*(t+1) - 2*S*(t) + S*(t-1) )^2
using a sparse-matrix approach via scipy.
Parameters
| Parameter | Default Value | Type |
|---|---|---|
| hp_lambda_n | 12 | int |
| fast_ma | 10 | int |
| slow_ma | 30 | int |
Risk Configuration
| Risk Parameter | Value |
|---|---|
| Max Position Pct | 10.0% |
| Stop Loss Pct | 3.0% |
| Take Profit Pct | 6.0% |
| Max Drawdown Pct | 12.0% |