Autoregressive Model
Autoregressive (AR) Model is a stochastic process representation for time series. In this model, the next variable of interest (e.g., next price) is modeled with linear combination of previous value(s) in a stochastic manner,
where c is a constant, y_t is the value of the variable of interest at time t and e_t is white noise. This stochastic process is usually referred to as an AR(p) model.
You can find more information about this stochastic process here.
Trading Algorithm
The trading algorithm is summarized below:
0. At the beginning of everyday's D1 candle (i.e., the open price of the day) the algorithm performs the following steps:
1. Compute the trend of the past N days' close price(= P[] array).
2. Remove the trend from P[], store the result in D[] array.
3. Using D[], estimate the parameters of an AR(1) model.
4. Using D[] and the estimated model, perform Dickey-Fuller test. If D[] is stationary, go to (5) else go to (0)
5. Predict the next value of D[] (which is D[N+1]) using the estimated AR(1) model.
6. decision <- empty
7. If D[N+1]>D[N], then action_set = {decision <- Buy, Close Sell} else if D[N+1]<D[N], then action_set = {decision <- Sell, Close Buy}.
8. Execute the action_set.
9. Go to (0)
Expert Advisor
I developed an EA for testing this trading idea based on AR(1) model. Here is a backtest result from 2000 to 2015 on EURUSD:
Discussion
Autoregressive (AR) Model is a stochastic process representation for time series. In this model, the next variable of interest (e.g., next price) is modeled with linear combination of previous value(s) in a stochastic manner,
Attached Image
where c is a constant, y_t is the value of the variable of interest at time t and e_t is white noise. This stochastic process is usually referred to as an AR(p) model.
You can find more information about this stochastic process here.
Trading Algorithm
The trading algorithm is summarized below:
0. At the beginning of everyday's D1 candle (i.e., the open price of the day) the algorithm performs the following steps:
1. Compute the trend of the past N days' close price(= P[] array).
2. Remove the trend from P[], store the result in D[] array.
3. Using D[], estimate the parameters of an AR(1) model.
4. Using D[] and the estimated model, perform Dickey-Fuller test. If D[] is stationary, go to (5) else go to (0)
5. Predict the next value of D[] (which is D[N+1]) using the estimated AR(1) model.
6. decision <- empty
7. If D[N+1]>D[N], then action_set = {decision <- Buy, Close Sell} else if D[N+1]<D[N], then action_set = {decision <- Sell, Close Buy}.
8. Execute the action_set.
9. Go to (0)
Expert Advisor
I developed an EA for testing this trading idea based on AR(1) model. Here is a backtest result from 2000 to 2015 on EURUSD:
Discussion
- Is such stochastic process (i.e., autoregressive models) a promising approach for statistical trading?
- How can we improve the trade logic?
- Does SL/TP settings for trades improve the results?
- What if we increase p in AR(p) model?
- Would it be more profitable if we use ARMA(p,q), ARIMA(p,d,q) and ARFIMA(p,d,q) models?
- What about non-linear autoregressive models?
- ...
I am attaching the EA here. Hopefully any further improvement in the strategy would result in a newer version of the EA to test, and who knows, trading live!
Attached File(s)
MathTrader7_AR1_EA.ex4
128 KB
|
1,397 downloads
Trading is the hardest way to make easy money...