DislikedI came across this today,Sat I'm not sure I have everything set up as it is the week end Will the ea show anything with no ticks coming through
or will it show past bar history.... In other words does this only work during trading hours
ThanksIgnored
/** * MT4/experts/scripts/ticks.mq4 * send a fake tick every 200 ms to the chart and * all its indicators and EA until this script is removed. */ #property copyright "© Bernd Kreuss" #import "user32.dll" int PostMessageA(int hWnd, int Msg, int wParam, int lParam); int RegisterWindowMessageA(string lpString); #import int start(){ int hwnd = WindowHandle(Symbol(), Period()); int msg = RegisterWindowMessageA("MetaTrader4_Internal_Message"); while(!IsStopped()){ PostMessageA(hwnd, msg, 2, 1); Sleep(200); } }
/** * MT4/experts/scripts/one_tick.mq4 * send exactly one fake tick to the chart and * all its indicators and EA and then exit. */ #property copyright "© Bernd Kreuss" #import "user32.dll" int PostMessageA(int hWnd, int Msg, int wParam, int lParam); int RegisterWindowMessageA(string lpString); #import int start(){ int hwnd = WindowHandle(Symbol(), Period()); int msg = RegisterWindowMessageA("MetaTrader4_Internal_Message"); PostMessageA(hwnd, msg, 2, 1); }
Dislikedwould this mean I would
buy AU 2 lots
sell EU 2 lots
GU nothing
Ucad sell 2 lots
Uchf nothing
UJ sell 1 lotIgnored
#property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Blue #property indicator_color2 Aqua #property indicator_color3 Red #property indicator_color4 Pink #include <mt4r.mqh> extern string R_command = "C:ProgrammeRR-2.11.0binRterm.exe --no-save"; extern int R_debuglevel = 2; int rhandle; double high[1000]; double low[1000]; double Buffer1[]; double Buffer2[]; double Buffer3[]; double Buffer4[]; double low_for[1000]; double high_for[1000]; int i; int init() { double low_fitted[1000]; double high_fitted[1000]; SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Buffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,Buffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,Buffer3); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,Buffer4); rhandle = RInit(R_command, R_debuglevel); RExecute(rhandle,"library(forecast)"); while(!RIsBusy(rhandle)){} ArrayCopy(high,High,0,1,1000); ArrayCopy(low,Low,0,1,1000); RAssignVector(rhandle,"high",high,ArraySize(high)); RAssignVector(rhandle,"low",low,ArraySize(low)); RExecute(rhandle,"high.arima=forecast(auto.arima(high))"); RExecute(rhandle,"low.arima=forecast(auto.arima(low))"); RExecute(rhandle,"arima.fitted=cbind(as.numeric(low.arima$fitted),as.numeric(high.arima$fitted))"); RExecute(rhandle,"arima.for=cbind(low.arima$lower[,2],as.numeric(low.arima$mean),as.numeric(high.arima$mean),high.arima$upper[,2])"); RGetVector(rhandle,"as.numeric(low.arima$fitted)",low_fitted,1000); RGetVector(rhandle,"as.numeric(high.arima$fitted)",high_fitted,1000); i=Bars-1; while(i>=0) { Buffer2[i]=low_fitted[1000-i]; Buffer3[i]=high_fitted[1000-i]; return(0); } } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); return(0); }
There has been a critical error Time : 2010.11.24 23:35 Program : Client Terminal Version : 4.00 (build: 226, 24 Mar 2009) OS : Windows XP Professional 5.1 Service Pack 3 (Build 2600) Processors : 2 x X86 (level 6) Memory : 2097151/2097151 kb Exception : C0000005 Address : 003D0899 Access Type : write Access Addr : 0000000B Registers : EAX=00000000 CS=001b EIP=003D0899 EFLGS=00010246 : EBX=0000000B SS=0023 ESP=00139B80 EBP=0000000B : ECX=7C9113F2 DS=0023 ESI=003D0898 FS=003b : EDX=04411E80 ES=0023 EDI=003D0000 GS=0000 Stack Trace : 00000000 00000000 00000000 00000000 : 00000000 00000000 00000000 00000000 : 00000000 00000000 00000000 00000000 : 00000000 00000000 00000000 00000000 Modules : 1 : 00400000 004BB000 c:program filesmetatrader admiral markets asterminal.exe 2 : 03560000 00015000 c:windowssystem32nvwddi.dll 3 : 03590000 00013000 c:windowssystem32btmmhook.dll 4 : 03790000 002C5000 c:windowssystem32xpsp2res.dll 5 : 043E0000 00039000 c:program filesmetatrader admiral markets asexpertslibrariesmt4r.dll 6 : 10000000 0017A000 c:windowssystem32nview.dll 7 : 5AD70000 00038000 c:windowssystem32uxtheme.dll 8 : 62740000 0000A000 c:documents and settingsall usersapplication datarealrealplayerbrowserrecordpluginchromehookrpchromebrowserrecordhelper.dll 9 : 662B0000 00058000 c:windowssystem32hnetcfg.dll 10 : 71A50000 0003F000 c:windowssystem32mswsock.dll 11 : 71A90000 00008000 c:windowssystem32wshtcpip.dll 12 : 71AA0000 00008000 c:windowssystem32ws2help.dll 13 : 71AB0000 00017000 c:windowssystem32ws2_32.dll 14 : 71BF0000 00013000 c:windowssystem32samlib.dll 15 : 72D10000 00008000 c:windowssystem32msacm32.drv 16 : 72D20000 00009000 c:windowssystem32wdmaud.drv 17 : 73DD0000 000FE000 c:windowssystem32mfc42.dll 18 : 74720000 0004C000 c:windowssystem32msctf.dll 19 : 755C0000 0002E000 c:windowssystem32msctfime.ime 20 : 76380000 00005000 c:windowssystem32msimg32.dll 21 : 76390000 0001D000 c:windowssystem32imm32.dll 22 : 763B0000 00049000 c:windowssystem32comdlg32.dll 23 : 76B40000 0002D000 c:windowssystem32winmm.dll 24 : 76BF0000 0000B000 c:windowssystem32psapi.dll 25 : 76C30000 0002E000 c:windowssystem32wintrust.dll 26 : 76C90000 00028000 c:windowssystem32imagehlp.dll 27 : 76F20000 00027000 c:windowssystem32dnsapi.dll 28 : 76F60000 0002C000 c:windowssystem32wldap32.dll 29 : 76FB0000 00008000 c:windowssystem32winrnr.dll 30 : 76FC0000 00006000 c:windowssystem32rasadhlp.dll 31 : 77120000 0008B000 c:windowssystem32oleaut32.dll 32 : 773D0000 00103000 c:windowswinsxsx86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83comctl32.dll 33 : 774E0000 0013D000 c:windowssystem32ole32.dll 34 : 77690000 00021000 c:windowssystem32ntmarta.dll 35 : 77A80000 00095000 c:windowssystem32crypt32.dll 36 : 77B20000 00012000 c:windowssystem32msasn1.dll 37 : 77B40000 00022000 c:windowssystem32apphelp.dll 38 : 77BD0000 00007000 c:windowssystem32midimap.dll 39 : 77BE0000 00015000 c:windowssystem32msacm32.dll 40 : 77C00000 00008000 c:windowssystem32version.dll 41 : 77C10000 00058000 c:windowssystem32msvcrt.dll 42 : 77DD0000 0009B000 c:windowssystem32advapi32.dll 43 : 77E70000 00092000 c:windowssystem32rpcrt4.dll 44 : 77F10000 00049000 c:windowssystem32gdi32.dll 45 : 77F60000 00076000 c:windowssystem32shlwapi.dll 46 : 77FE0000 00011000 c:windowssystem32secur32.dll 47 : 7C340000 00056000 c:windowssystem32msvcr71.dll 48 : 7C3A0000 0007B000 c:windowssystem32msvcp71.dll 49 : 7C800000 000F6000 c:windowssystem32kernel32.dll 50 : 7C900000 000B2000 c:windowssystem32ntdll.dll 51 : 7C9C0000 00817000 c:windowssystem32shell32.dll 52 : 7E410000 00091000 c:windowssystem32user32.dll Call stack :
[2988] installed exception handler for C:Program FilesMetaTrader Admiral Markets ASexpertslibrariesmt4R.dll [2988] <2> Create: trying to start R: C:ProgrammeRR-2.11.0binRterm.exe --no-save [2988] <-1> TRConsole: destroying [2988] removed exception handler for C:Program FilesMetaTrader Admiral Markets ASexpertslibrariesmt4R.dll
DislikedIt needs ticks to trigger the start() function. There are scripts that can simulate this on weekends.
For example this to send a continuous stream of ticks to the chart:
[code]
/**
* MT4/experts/scripts/ticks.mq4
* send a fake tick every 200 ms to the chart and
* all its indicators and EA until this script is removed.
*/
#property copyright " Bernd Kreuss"
#import "user32.dll"...Ignored
Rx("multiA[,1] <- tempA")
* variable <- rbind(variable, vector)
Disliked7Bit, great job on creating mt4R.dll. I have cobbled up a wrapper for VB6Ignored
QuoteDislikedThe two matrix routines RAssignMatrix and RAppendMatrixRow are giving me problems. It may be that VB6 and Pascal matrix structures are incompatible for multi-dimensional arrays, or more likely that my infantile understanding of R / Pascal and how they handle arrays/matrices is the problem. Case in point: I don't even know how to check matrix / vector bounds within R.
QuoteDislikedI figured a workaround using RAssignVector, and then combining a temporary vector into an already dimensioned matrix in R one column at a time:copies tempA to column 1 of multiA. Repeated in a loop, this approximates the functionality of RAssignMatrix.Inserted CodeRx("multiA[,1] <- tempA")
QuoteDislikedIt appears that RRowBindVector(), which is mentioned in the RAssignMatrix comments of mt4R.mqh is not found in the mt4R.dll source code.
Dislikedphwoar that's a wicked hack. haven't used it but can see the potential.
question 1 : can this be used to 'create' a fake symbol and then stream data to it? an outside program could be set up as the 'server' sending fake data internally?
or, you could stream fake data to an unused exotic symbol you would never actually want to trade but can load into mt4... that way you aren't breaking any data on your real-traded charts.
question 2 : can this be used to set a custom spread? (or was that the point and i'm too tired to realise?)Ignored
DislikedLooks like something simple failed:
Inserted Code[2988] installed exception handler for C:Program FilesMetaTrader Admiral Markets ASexpertslibrariesmt4R.dll [2988] <2> Create: trying to start R: C:ProgrammeRR-2.11.0binRterm.exe --no-save [2988] <-1> TRConsole: destroying [2988] removed exception handler for C:Program FilesMetaTrader Admiral Markets ASexpertslibrariesmt4R.dllIgnored