MQL4 -gt R-Project - Interface Library - Page 8
Page 8 of 6118 FirstFirst ... 678910 ... LastLast
Results 71 to 80 of 175

Thread: MQL4 -gt R-Project - Interface Library

  1. #71
    Well it appears the exception is generated frequently along with the indior works using R version 3.0. I would not know anything about the exception message that occurs on each loop of the 23,, if I did not have debugview. Now to get on with using the R messaging within my own MT4 undertaking.

    Oh the penny just dropped. It is MT4 that is causing the exception and nothing related to R. By extending the debugview window it says at the end of the line
    terminal.exe EXCEPTION_CONTINUE_SEARCH
    The strange thing is that I did not notice this occurring the first time that I ran debugview with MT4 but it doesn't indicate it was not there and it's always there now no matter R or indiors used. MT4 is naff to start with people would not be messing around with R I guess although A constant load on the windows system by MT4 appears a bit naff to me.

  2. #72
    Hey everyone I am having a issue with the R API that is truly perplexing. I can conduct an EA and utilize RExecuteAsync(), RAssignVector(), etc.. . I am currently passing vectors to R and then calling an R script file to run computations on the vectors that were passed and plot some metrics. My plot() call in my R script will work a few times (i.e. the R script will properly plot the metrics, I will shut the plot window and following time start() is called from the EA the plot will show back up again) and then will stop working. I don't have any idea why this is happening or what's going on. Has anyone else experienced this?

    Edit: Solved the issue, there was a mistake in my MQL4 evaluation script that was not within my R test script. I also am posting my progress on some cointegrated trading progr, don't hesitate to test it out at my site: http://www.pamexx.com

  3. #73
    The joke was on me. I began a couple of MT4 platforms and they didn't provide the exclusion error leaving debugview window hushed. It was that I had a DLL based indior running at the MT4 on another chart that has been minimised which caused the exclusion error on that MT4 platform, nothing related to R.

  4. #74
    I think that your work is wonderful. Congratulations on your work.
    I was searching at the arima indior.
    I changed a few lines of code to attempt and use the auto.arima role in R.
    It compiled OK but when I attempted to use it I did not get anything on the chart.
    I checked the code but I can't figure out what I am doing wrong.
    Is it possible to post a couple more indior examples using R capabilities. That would be helpful.

  5. #75
    Quote Originally Posted by ;
    I think your work is really amazing. Congratulations on your amazing work.I was appearing in the arima indior.I changed a couple of lines of code to try to use the auto.arima role in R.It compiled OK but when I attempted to use it I did not get anything on the chart.I assessed the code but I can't figure out exactly what I am doing wrong.Is it possible to post a couple more indior illustrations using R functions. That would be helpful.
    Adamfx, you might also post your code to let's check if there's any problem, 7bit used simple OLS way in his sample code which can be readily adapted to other regression even like svm lt;- I am testing this.

  6. #76
    Also a big THX to 7bit - I have this working under Ubuntu 12.10, running MT4 v500 and R 3.0.1 under wine. I'm hoping to link ticks to some tick stream analyzer in R. I'll set up a site, finally to report.

  7. #77
    It appears I'm undoubtedly not the only one who enjoys the R MT4 interface of 7bit. :--RRB-
    I have been trying to setup an EA to check couple of models with R interface, but I am stucked in the very beginning of using 7bit's indior code to build an evaluation EA framework, the Print does not throw out anything in the log window, I'm not a programmer so do't blame me the bad structure and that I really do appreciate if anybody would give me some clues for the below code.

    Inserted Code #property copyright #65533; Bernd Kreuss #include lt;mt4R.mqhgt; #include lt;common_functions. Mqhgt; extern int back = 500; extern int order = 200; extern int forward = 20; extern string R_command = C:RR-3.0.1bini386Rterm.exe --no-save; extern int R_debuglevel = 2; int rhandle; int init() rhandle = RInit(R_command, R_debuglevel); int deinit() RDeinit(rhandle); int begin () double hist#91;#93;; double pred#91;#93;; double buf_prediction#91;#93;; int I; ArrayResize(hist, back); for (I=0; ilt;back; I ) hist = Close; //fill up the hist array with Close price RAssignVector(rhandle, hist, hist, ArraySize(hist)); //Can I still need this? RExecute(rhandle, hist lt;- rev(hist)); //get into the ideal order in time RAssignInteger(rhandle, ord, order); RExecuteAsync(rhandle, model lt;- ar(hist, aic=FALSE, order=ord, method='ols')); //build the ols version if (RGetInteger(rhandle, as.integer(exists('model'))) == 1) // there is a model (the variable is defined ). // This usually means a previously started RExecuteAsync() has completed. // we can forecast from this model and plot it. RAssignInteger(rhandle, forward, forward ); RExecute(rhandle, pred lt;- predict(model, n.ahead=forward )$pred); // if There's a model, forecast a forward value ahead ArrayResize(pred, forward ); RGetVector(rhandle, rev(pred), pred, forward ); for (I=0; ilt;beforehand; I ) buf_prediction = pred; //buffer of forecast ahead worth Printing (histNumber 91;1#93;-RRB-; Print (Close); Print (buf_prediction#91;1#93;-RRB-; RExecute(rhandle, save.image()); return(0);

  8. #78
    croupier,

    View the attached document. I simplified it a bit - with the simple (ier) interface rather than the original interface. I try to stay away from RExecuteAsync because you can't ensure that MT4 will execute as you think it should. Consequently I restricted updating in the start() function to once a pub to cut down on wasted processing time.

    All this EA does is print out three numbers, but you should be able to get some comments .

    Also see the variable to toggle save / no save for your picture and a file path. Note the arrangement of the strings used to get a quote within a string. (backslash quote)
    https://www.nigeriaforextrading.com/...0708853498.mq4

  9. #79
    It works! Thank you, FXEZ.
    I will try my versions and report back to the thread later.

    Quote Originally Posted by ;
    , See the attached document. I simplified it a little - with the easy(ier) interface instead of the original interface. Since you can not guarantee that MT4 will execute as you think it should I try to stay away from RExecuteAsync. As a result I restricted updating in the beginning () function to once per pub to cut down on wasted processing period. All this EA does is print three numbers out, but at least you ought to be able to get some feedback there. Also see the factor to toggle save / no save for your picture and a file path. Notice the arrangement...

  10. #80
    Inserted Code #property copyright ? Bernd Kreuss #include lt;mt4R.mqhgt; #include lt;common_functions. Mqhgt; extern int back = 500; extern int order = 200; extern int ahead = 20; extern string R_command = C:/R/R-3.0.1/bin/i386/Rterm.exe --no-save; extern int R_debuglevel = two; extern bool saveImage = false; extern string saveDir = C:/R/; extern int delta_L=30; extern int delta_S=30; extern double TakeProfit = 70; extern double StopLoss = 35; extern double Lots = 0.1; extern double Poin; //int rhandle = 0; datetime thistime; int init() StartR(R_command, R_debuglevel); should (Stage == 0.00001) Poin = 0.0001; //6 digits Points fix else if (Stage == 0.001) Poin = 0.01; //3 digits Points fix(for Yen based pairs) else Poin = Stage; //Normal // set thistime into a arbitrary init value so the start function will operate the first-time thistime = Time#91;5#93;; return(0); int deinit() if (UninitializeReason() ! = REASON_CHARTCHANGE) StopR(); return(0); int begin () if (thistime == Time#91;0#93;-RRB- return(-1); // only update once per pub double histNumber 91;#93;; double pred#91;#93;; double buf_prediction#91;#93;; int I,ticket; // if(Volume#91;0#93;gt;1) return; //1 pub one order if(AccountFreeMargin()lt;(1000*Lots)) Print(We Don't Have Any cash. Free Margin =, AccountFreeMargin()); return(0); //cash check ArrayResize(hist, back); for (I=0; ilt;back; I ) hist = Close; //fill up the hist range with Close price Rv(hist, hist); Rx(hist lt;- rev(hist)); //get into the Ideal order punctually Ri(ord, order); Rx(version lt;- ar(hist, aic=FALSE, order=ord, method='ols')); //build the ols model if (Rgi(as.integer(exists('version'))) == 1) // if there is a version (the factor is defined ). Ri(ahead, ahead); Rx(pred lt;- predict(model, n.ahead=ahead)$pred); // when There's a version, forecast a ahead value beforehand ArrayResize(pred, ahead); Rgv(rev(pred), pred); // Open Buy_Order if((predNumber 91;0#93;-Open#91;0#93gt;delta_L*Point) //gap bigger than Long threshold ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Stage,Ask TakeProfit*Point,busted,0,Green); // execution when (ticketgt;0) if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) Print(BUY order started:,OrderOpenPrice()); else Print(Error opening BUY order:,GetLastError()); return(0); // exit // Open Sell_Order if((Open#91;0#93;-pred#91;0#93gt;delta_S*Point) ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid StopLoss*Point,Bid-TakeProfit,0 Stage,busted,0,Red); // execution when (ticketgt;0) if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES )) Printing (SELL order started:,OrderOpenPrice()); else Print(Error opening SELL order:,GetLastError()); return(0); // exit if (saveImage) Rx(save.image( saveDir .RData)); thistime = Time#91;0#93;; return(0);

    As a Fast proof of concept (so do not use on LIVE account), the above EA reads MT4 Close info in an array in R and forecast a value using ols version, and returns back to MT4 for order launching. It was able to open ~500 order in 6 hours and busted half of a demo account.
    FXEZ, why do you put thistime = Timing [5];, not Time[0]?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.