I am using the forecast package in R and this creates a forecast object.
I am wanting to convert the forecast into a vector so that I can use 7bits wrapper and use R in MQL4 code.
Example forecast code:
> forecast(fit, h=5)
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
1057 1.605098 1.602110 1.608087 1.600528 1.609668
1058 1.605109 1.600891 1.609327 1.598658 1.611561
1059 1.604868 1.599723 1.610012 1.597000 1.612735
1060 1.604978 1.599037 1.610919 1.595892 1.614065
1061 1.605162 1.598511 1.611813 1.594990 1.615335
I would like to be able to somehow store those Forecast, lo 80, hi 80 etc. In a vector so I can pull them out of R and into MQL4 for use in an indicator.
I tried:
> test1 <- forecast(fit, h=5)
> test1
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
1057 1.605098 1.602110 1.608087 1.600528 1.609668
1058 1.605109 1.600891 1.609327 1.598658 1.611561
1059 1.604868 1.599723 1.610012 1.597000 1.612735
1060 1.604978 1.599037 1.610919 1.595892 1.614065
1061 1.605162 1.598511 1.611813 1.594990 1.615335
However if I try to pull out forecast I get:
> test1$Forecast
NULL
If I run head the structure appears as:
> head(test1)
$method
[1] "ARIMA(2,1,2) "
$model
Series: mt4test$close
ARIMA(2,1,2)
Coefficients:
ar1 ar2 ma1 ma2
-0.5030 -0.9910 0.4993 0.9783
s.e. 0.0123 0.0089 0.0202 0.0140
sigma^2 estimated as 5.437e-06: log likelihood=4897.31
AIC=-9784.61 AICc=-9784.55 BIC=-9759.81
$level
[1] 80 95
$mean
Time Series:
Start = 1057
End = 1061
Frequency = 1
[1] 1.605098 1.605109 1.604868 1.604978 1.605162
$lower
80% 95%
[1,] 1.602110 1.600528
[2,] 1.600891 1.598658
[3,] 1.599723 1.597000
[4,] 1.599037 1.595892
[5,] 1.598511 1.594990
$upper
80% 95%
[1,] 1.608087 1.609668
[2,] 1.609327 1.611561
[3,] 1.610012 1.612735
[4,] 1.610919 1.614065
[5,] 1.611813 1.615335
Any help would be appreciated. It is keeping me from moving ahead with my tinkering haha.
Thanks in advance.