rosasurfer / mt4-mql Goto Github PK
View Code? Open in Web Editor NEWMetaTrader MQL4 framework
License: Do What The F*ck You Want To Public License
MetaTrader MQL4 framework
License: Do What The F*ck You Want To Public License
Checking and execution of stoplosses in Strategy Tester and on demo servers is broken. In a fast market both limits of a pending entry order with attached stoploss may be triggered by the same tick. Tester and demo servers only check a single order limit per ticket and tick. As a result such an entry order is reported as open (filled) while in a real market it would be closed. The stoploss limit will be checked at the next tick but if the next tick doesn't trigger that limit the order will stay open and the position becomes invalid. In a real market such an order would be closed. In tester and on demo servers it may stay open for an infinite time.
Imagine a market at 1.2000, a Buy Limit order at 1.1998 with a SL at 1.1995. Further assume an open long position with SL at 1.1990. If the market spikes down to 1.1990 with a single tick (e.g. news) all existing limits are triggered (the buy limit and the two stoplosses). Despite the market now being at 1.1990 tester and demo servers will report the Buy Limit order at 1.1998 as open and the SL at 1.1995 as not executed.
If the next tick is above 1.1995 (the SL of the wrongly reported open order) the SL is not triggered and the order is not reported as closed again. If the market continues to go up the SL may never be triggered and the order stays open, while in a real market the order would be immediately closed. Tester and demo server will be in an illegal state.
The workaround is to manually check the exit limit of orders with entry and exit limits on the tick the entry limit is reported as executed, and to manually execute such ignored exit limit.
Cannot create demo account after installing build 1384
When a MQL library's deinit()
function is called previously defined global string
variables are already destroyed and reset to a non-initialized state. The bug always occurres with indicators in regular charts (during their init cycle) and with indicators and experts in the Strategy Tester. The bug was not observed with scripts. All tested terminals from build 225 to build 1090 behave the same.
string foo;
/**
*
*/
int init() {
foo = "bar";
Print("init() foo: \""+ foo +"\"");
int error = GetLastError();
if (error != ERR_NO_ERROR) Print("error: "+ ErrorDescription(error));
return(error);
}
/**
*
*/
int deinit() {
Print("deinit() foo: \""+ foo +"\"");
int error = GetLastError();
if (error != ERR_NO_ERROR) Print("error: "+ ErrorDescription(error));
return(error);
}
init() foo: "bar"
deinit() foo: "bar"
init() foo: "bar"
deinit() foo: ""
error: ERR_NOT_INITIALIZED_STRING
none
If string
variables are needed in deinit()
the values have to be stored elsewhere, e.g. in astring[]
array.
Hi, I found your EA and wanted to try it. did all download but find that the Metatrader editor cannot compile. Maybe there is a manual or installation guide available that I could not find yet?
I´m definitly a biginnner with this tool. Kindly allow my questions.
The sizes.mqh is creating probelms during compilation. Compile "complaints" are about the "." for all definitions.
#define FXT_HEADER.size
Simiplar complaints in stddefines.mqh with e.g.
#define Math.E (again the "." make the trouble)
all in all I get 3005 errors and 712 warnings. for sure stupid me!
any help will be appreciated.
thanks
Could you please give me help?
Some broker using this open source Metatrader 4.
But Officially release Metataquotes is latest build 1380.
When broker using 1384 then we migrate to MT4 build 1380 (officially release). All order not show in version 1380.
Could you please help about this?
After opening the "Load expert" dialog the terminal sometimes executes Expert::init()
before the OK
button is clicked. This can happen immediately or later (as long as the dialog is not closed). If it happens the expert is initialized with the default parameters, already loaded presets from a presets file are not applied. Further the usual log statement showing the applied parameters will not appear.
After the dialog is closed by clicking the OK
button the real input parameters are logged and Expert::init()
is called a second time. So, if this error occures the terminal log shows two log statements ExpertName Symbol,Period: initialized
, and only one log statement with the applied input parameters.
Related function return values in the first init()
call indicate no irregularities, i.e.:
UninitializeReason() // the regular value for the second init() call
WindowOnDropped() = 0 | -1 // both values have been observed
WindowXOnDropped() = -1
WindowYOnDropped() = -1
I want to create mt5 bot because mt5 is intergrated with python but the problem is that my broker doesn't have option to copy trade from mt5! So please is they any how i can create EA for mt4 using python?
Hi,
Best wishes for the new year.
I came through your mt4 project and I think you so much for sharing. I am interested in testing the indicators and EAs. However, and as already stated by another user, I am not able to compile the indicators and EAs even with an old mt4 editor.
Also, I tried many times to get the binaries (ex4) from the release folder you provided, but it is always empty.
Would it be possible to get the binaries (ex4 files) so I can test them.
Thank you in advance and have a great day.
Kind regards.
In mql4, there are iRSIOnArray, iStdDevOnArray, iMAOnArray, iMomentumOnArray, iEnvelopesOnArray, iCCIOnArray, iBandsOnArray
and of course Metaquotes removed them in mql5.
Can you code them for mql5 and mql4 ?
Apparently there is a bug in iRSIOnArray
https://www.mql5.com/en/forum/327461
and he did his own version here
https://www.mql5.com/en/code/27478
where are those iRSIOnArray etc stored in mt4 folders?
How to reproduce:
int oe[];
int longTicket = OrderSendEx("EURUSD", OP_BUY, 1.4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, Blue, NULL, oe);
int shortTicket = OrderSendEx("EURUSD", OP_SELL, 0.2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, Red, NULL, oe);
bool status = OrderCloseByEx(longTicket, shortTicket, Orange, NULL, oe);
ORDER_EXECUTION.toStr(oe, true);
Expected result:
The struct should contain the execution data of the closed partial position, i.e. original open time and price, closing time and price, and the amount of closed lots.
Actual result:
ORDER_EXECUTION.toStr() {
error=0,
symbol="EURUSD", digits=5, stopDistance=0, freezeDistance=0,
bid=1.2018'3, ask=1.2018'4,
ticket=1, type=OP_BUY, lots=1.4,
openTime=0, openPrice=0.0000'0,
stopLoss=0.0000'0, takeProfit=0.0000'0,
closeTime='2017.09.20 12:48:05', closePrice=1.2018'3,
swap=0.00, commission=-0.86, profit=-26.63,
duration=0, requotes=0, slippage=0.0, comment="",
remainingTicket=3, remainingLots=1.2
}
Note that openTime
and openPrice
are empty and lots
contains the full lots of the ticket passed in the first parameter.
Hello
This looks like a really excellent project! Nice work!
Is the source code for the dlls also open source?
Thanks and regards
Hi,
I'm trying to load MT4 indicators (for example HalfTrend.mq4).
Getting compilation errors, for example:
'.' - unexpected in macro definition sizes.mqh 42 11
'.' - unexpected in macro definition stddefines.mqh 67 13
'@' - unknown symbol HalfTrend.mq4 265 7
'.' - semicolon expected stddefines.mqh 20 22
'.' - semicolon expected HalfTrend.mq4 20 20
I have downloaded the source code today (28NOV21) and placed /mql4 files in my DataFolder
.
Using the latest versions of MT4 and MetaEditor:
Did I miss any step in the installation?
Hello, using the latest release im trying to test out the snowroller EA. I get the following error when I try to run it in the tester:
ERROR: EURUSD,M15 SnowRoller::init(2)->SyncMainContext_init() [ERR_DLL_EXCEPTION]
I think it might be an access violation. The experts tab shows this:
2021.04.24 20:32:56.409 2018.01.02 00:00:08 SnowRoller EURUSD,M15: function 'SyncMainContext_init' call from dll 'rsfExpander.dll' critical error c0000005 at 6222B9F0.
I'm running mt4 build 1280.
Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.