# Thread: Simulation of technical analysis indicators

1. ## Simulation of technical analysis indicators

Hello!
I have to test effectiveness of technical analysis indicators. Major problem is that I don't know how to correctly use output of arima.sim. I did sequantially: In order to conduct this study I created ARIMA model based on real data:
Code:
``````    data <-read.csv(file="enea.csv", header=TRUE, sep=";",dec=".")
dates = as.POSIXct(strptime(dane[,1], format="%Y-%m-%d"))
closnigPrice= xts(dane[,c(5)], order.by = dates)
model <- auto.arima(closingPrice, stepwise=FALSE,approx=FALSE)
model
Acf(model\$residuals)``````
Next I need to generate data based on the coefficient of this model (created above):

Code:
`````` fit <- arima.sim(model=as.list(coef(model)), n=1249)
fit``````
arima.sim return values such as:

Code:
``````    [1]  0.847159832 -0.013145894 -0.693873961 -0.369817368  0.159847319 -1.205464018  0.726248204
[8] -1.053571191  1.119042946  1.002395435 -0.388118449 -0.438277787  0.550959984  1.257593875
[15] -0.781547747 -1.419707655  1.395393362  0.950545042 -0.382795625 -1.808498408  0.712247879
[22] -0.346448159  0.431701619 -0.111542058 -0.074330765  1.344385279 -1.448159915  0.361477760``````
What should I do next? I used function diffinv to reverse differencing (closing price are non-stationary time series so I had to use differencing).

Code:
``fit <- diffinv(fit)``
result:

Code:
``````0.847159832 -0.013145894 -0.693873961 -0.369817368  0.159847319 -1.205464018  0.726248204
[8] -1.053571191  1.119042946  1.002395435 -0.388118449 -0.438277787  0.550959984  1.257593875``````
But I still have negative(and small) values, So I did:

Code:
``fit <- fit+100``
Please tell me, Is this a good way? In next step I need to use technical analysis on this simulated data to check how big is the profits thanks to using indicators.

2. ## Re: Simulation of technical analysis indicators

You do not present much data.

So I cannot make sure.

But I guess, you should use diff() before building your ARIMA model.

Consuli

 Tweet

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts