Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:57:07+00:00 2026-06-15T21:57:07+00:00

I am using the forecast package in R and this creates a forecast object.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:57:08+00:00Added an answer on June 15, 2026 at 9:57 pm

    Function forecast() produces list. With function str() you can check structure of this object and with function names() see the names of each element in this list.

    library(forecast)
    fit <- Arima(WWWusage,c(3,1,0))
    test1<-forecast(fit)
    
    names(test1)
    [1] "method"    "model"     "level"     "mean"      "lower"     "upper"     "x"        
    [8] "xname"     "fitted"    "residuals"
    
     #to extract forecast
    test1$mean
    
    Time Series:
    Start = 101 
    End = 110 
    Frequency = 1 
     [1] 219.6608 219.2299 218.2766 217.3484 216.7633 216.3785 216.0062 215.6326 215.3175 215.0749
    
     #or as vector
    as.vector(test1$mean)
     [1] 219.6608 219.2299 218.2766 217.3484 216.7633 216.3785 216.0062 215.6326 215.3175 215.0749
    
     #to extract upper interval
    test1$upper
    
               80%      95%
     [1,] 223.5823 225.6582
     [2,] 228.5332 233.4581
     [3,] 232.7151 240.3585
     .... .... ....
    [10,] 260.7719 284.9625
    
     #to extract lower interval
    test1$lower
    
     #to extract only 95% upper interval
    test1$upper[,2]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
I tried using the forecast package in R. When plotting the forecast for a
I have a problem with the Wunderground forecast that I am using to retrieve
I am using raptureXML to extract data from my XML <forecast .../> tags. This
I can use ggplot2 to store the output of ggplot command to an object
I'm using libxml to parse this. I want the yweather:forecast nodes. I tried /rss/channel/item/yweather:forecast
I would like to convert an ARIMA model developed in R using the forecast
I have been using the scikits.statsmodels OLS predict function to forecast fitted data but
Using CI for the first time and i'm smashing my head with this seemingly
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.