Download This R Autoregression MT4 Indicator FREE - Forex Robot 2.0 (2024)

In the last post we showed you how you can connect the powerful R software with MT4. If you haven’t read the post on how to connect R with MT4, you should read it now before you continue reading this post. In this post how to connect R with MT4 I have explained how difficult it was to connect R with MT4 and how it was done. As said in that post R is a powerful data analysis and machine learning software that is available FREE. We will be using R more and more in the coming posts to develop powerful machine learning MT4 indicators. You should first download this software and install it on your computer.

What Is Autoregression?

Time series have this general property that past values are auto correlated This can be judged by drawing the Correlogram of a time series. A correlogram is a plot of the auto correlation of the different past values with one another. What this means in simple terms is that past values have important information about the future values. One way of extracting that information is by regressing the present value of a time series with it’s past values. This is known as Autoregression. Autoregression also known as Autoregressive Modelling (AR).

AR modelling is a forecasting tool for predicting the short term future values of a time series. We can fit a moving average model to a time series. ARIMA is a model that fits an autogressive and a moving average model. ARIMA means Autoregressive Integrated Moving Average. If you are feeling confused you can watch the video below that explains these terms! But you don’t need to know how to do time series analysis in too much depth. R Indicator is going to do everything for you. You should however have some rudimentary understanding so that you know what you can achieve and what you cannot achieve when you use the time series analysis.

As said above autoregression is based on the idea that the past values of a time series can be used to predict the future values. This is precisely the premise on which Technical Analysis is based. When we look at the chart we are looking for patterns that can predict the future price action. If the above autoregression indicator confirms your technical analysis, it will help you reduce your losing trades. You can use this R indicator as a filter to reduce your losing trades.

MQL4 language has severe limitations. It does not have libraries that can implement different statistical algorithms. However by connecting R with MT4, we can overcome that limitation. When we connect R we can use its powerful data analysis and machine learning algorithms in analyzing the currency pair time series and then use the predictions in real time in our trading. This is precisely what we want.

How To Install Autoregression R MT4 Indicator?

In this post we give you the code for a R indicator that fits an autogressive model to the closing price of the currency pair time series. First you need to download R software from the R-Project site. Install it on your computer. Then you need to download these files:

MT4R.DLL

MT4R.MQH

COMMON_FUNCTIONS.MQH

The following infographic explains step by step how to install this Autoregression R MT4 indicator.

Download This R Autoregression MT4 Indicator FREE - Forex Robot 2.0 (1)

Now as shown in the above infographic, first you will copy the following code in a notepad text file and save it as R-Indicator.mq4 file. I want to make it clear that without installing R software, this indicator is not going to work. R is a powerful data analysis and machine learning software that you can download free. In the above infographic you can copy the link from where you can download this R software. After downloading it, you should install it on your computer.

In the code you can see a bold line. In the comment above I have explained that you need to change the path of the R software as has been made bold. The path can be C drive just like that in the code or it can be E, D or whatever drive you install the R software on your computer. You will also change the R version if it is different than that shown in the code. You can do that in the text file and then save it as an mq4 file. You can open it in MetaEditor and then make the change and compile the code. It is upto you. It is not difficult. Once you have the R-Indicator.mq4 in the Indicator folder you are all set now. Just open MT4 and double click on R-Indicator name and you will see the indicator on chart.

//+——————————————————————+
//| R-Indicator.mq4 |
//| Copyright 2010, Bernd Kreuss |
//| https://www.doubledoji.com |
//+——————————————————————+
#property copyright “Copyright 2010, Bernd Kreuss”
#property link “https://www.doubledoji.com”
#property version “1.00”
#property strict
#property indicator_chart_window

#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_width1 2

#include <mt4R.mqh>

extern int order = 200;
extern int back = 500;
extern int ahead = 20;

int R;
double buf_prediction[];

int init(){
SetIndexBuffer(0, buf_prediction);
SetIndexStyle(0, DRAW_LINE);
SetIndexShift(0, ahead);

//–You should change the following bold path in your MQL4 file according to your hard drive and R version

R = RInit(“C:/Program Files/R/R-3.2.5/bin/x64/Rterm.exe –no-save”, 2);
Comment(“history: ” + (string)back + ” bars, method: OLS, order: ” + (string)order);
return(0);
}

int deinit(){
RDeinit(R);

return(0);
}

int start(){
double hist[];
double pred[];
int i;

if (RIsBusy(R))
{
// last RExecuteAsync() is still not finished, do nothing.

return(0);
}

if(RGetInteger(R, “as.integer(exists(‘model’))”) == 1)
{
// there exists a model (the variable is set).
// This means a previously started RExecuteAsync() has finished.
// we can now predict from this model and plot it.
RAssignInteger(R, “ahead”, ahead);
RExecute(R, “pred <- predict(model, n.ahead=ahead)$pred”);
ArrayResize(pred, ahead);
RGetVector(R, “rev(pred)”, pred, ahead);
for (i=0; i<ahead; i++){
buf_prediction[i] = pred[i];
}
}

// make a (new) prediction
// move some history over to R
ArrayResize(hist, back);
for (i=0; i<back; i++){
hist[i] = Close[i];
}
RAssignVector(R, “hist”, hist, ArraySize(hist));
RExecute(R, “hist <- rev(hist)”);

// crunch the numbers in the background and return from the start() function
// RIsBusy() in the next ticks will tell us when it is finished.
RAssignInteger(R, “ord”, order);
RExecuteAsync(R, “model <- ar(hist, aic=FALSE, order=ord, method=’ols’)”);
return(0);
}

Now you can use this Autoregression R MT4 indicator. You can see in the screenshot below that this indicator predicts price action in the future. This is a great help when you trade. In the screenshot you can see price action has been predicted to go up and then drop. When you see that price is going up, a long trade will be appropriate.

Download This R Autoregression MT4 Indicator FREE - Forex Robot 2.0 (2)

Download This R Autoregression MT4 Indicator FREE - Forex Robot 2.0 (2024)

FAQs

What is the most useful indicator in MT4? ›

Top 10 MT4 indicators for technical analysis
  1. Trend Magic Indicator. The Trend Magic indicator is a custom indicator available in MT4 that uses the Trend Magic algorithm to generate trade signals. ...
  2. Aroon Indicator. ...
  3. Gentor CCI. ...
  4. MA Channels FIBO. ...
  5. Fisher Indicator. ...
  6. Zigzag Indicator. ...
  7. DeMarker Indicator. ...
  8. Rate of Change Indicator.

Which forex robot is the most profitable? ›

Waka Waka is a record-breaking expert advisor (EA) forex trading bot – that has offered an account gain of more than 7,500% since its origin.

Do forex trading robots really work? ›

Do Forex trading robots really work? Though forex auto trading robot software promises to make beneficial trades, not all automated forex trading robots are what traders expect them to be. Moreover, some federal governments consider bots to be scams.

Which bot is best for forex? ›

Top 10 Best Forex Trading Robots: Check the List
  • MetaTrader 4 (MT4) Listed as the most popular trading platform, MetaTrader 4 is widely popular. ...
  • MetaTrader 5 (MT5) ...
  • WallStreet Forex Robot 2.0 Evolution. ...
  • Forex Flex EA. ...
  • Forex Diamond EA. ...
  • FXStabilizer EA. ...
  • Forex Fury. ...
  • Forex Gold Investor.
Mar 20, 2024

Can you make money with forex robots? ›

1. No Guarantee of Success: Forex robots cannot guarantee consistent profits. The market is unpredictable, and there are no foolproof strategies. Some robots may perform well in certain market conditions, but struggle in others.

Do forex robots make losses? ›

There is no guaranteed way to make profits in Forex trading , and this applies to auto - trader EA robots as well . While these robots may have advanced algorithms and strategies , they are still subject to market volatility and unexpected events that can result in losses .

Are robots legal in forex? ›

It is legal to trade with forex robots, but that doesn't mean everything that has to do with trading with forex robot is legal. Even though you can drive, you can't do a lot of things with your car. There are a variety of practical and regulatory reasons why certain brokers do not permit traders to utilize robots.

What is the most successful trading bot? ›

  • Cryptohopper. Best crypto trading bot overall. Learn More.
  • Coinrule. Best crypto trading bot for no-code trading rules. Learn More.
  • TradeSanta. Best bot for beginning traders. Learn More.
  • Pionex. Best exchange-built bots. Learn More.
  • Shrimpy. Best social trading bot. Learn More.
Jun 3, 2024

Which forex is the most profitable? ›

Frequently Asked Questions About Forex Currency Pairs

The EUR / USD is actually the best currency to trade, its the most liquid and cheap to trade and most of the moves are quite logical in a way, the EURUSD currency pair often has a negative correlation with USD / CHF and a positive correlation with GBP / USD.

Which AI is best for forex trading? ›

Some of the best AI forex trading platforms include MetaTrader 4, MetaTrader 5, cTrader, TradingView, and ProRealTime. Some of the most popular tools for AI trading include automated trading and copy trading tools, as well as market scanners such as those provided by Autochartist.

What is the best profitable indicator in MT4? ›

The top FX MT4 indicators - Key takeaways
  • Moving Average Convergence/Divergence (MACD)
  • Stochastic oscillator.
  • Bulls/Bears powers.
Nov 12, 2023

What are the leading indicators in MT4? ›

The most typical leading indicators that comes pre-installed with MetaTrader 4 (MT4) are oscillators like the Relative Strength Index and the Stochastic Oscillator. Volatility indicators like the Donchian channel and volume indicators like the On-balance Volume indicator are also considered leading.

What is the best leading indicator for trading? ›

If you're able to identify the type of market you are trading in, you can pinpoint which indicators could provide helpful signals and which ones are worthless and to ignore. Popular leading indicators are the Stochastic, the Relative Strength Index (RSI), Williams %R, and the Momentum indicator.

Top Articles
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 5636

Rating: 4.3 / 5 (54 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.