![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Help with simple DLL call?
so all i want to do is get the MT4 Acc# from a dll.
Dll_call asks Dll_call_include for the "GetAccountNumber()" double from Dll_call.dll
simple right? the ea loads fine even with the wrong Acc# in the dll. Mt4 asks to use the dll.
the 3 files are in the right 3 folders, the dll is a .dll file (attached as a .txt to view code.
could someone please view the code for errors?
thanks
Did you include GetAccountNumber in a .def file in your compiled dll? You have to do this for it to work.
Also, make sure Allow Dll imports is selected for your expert.
Hope this helps.
-wolfe
im a bit new to C++ so i guess ill study def files. i read adding the def file to the librarys folder where the DLL is may solve this but no.
also read adding the DLL to the system32 folder, still no.
i plan to email this project to people so id rather not have to say how to place 4 different files all in different folders. is this the only way?
is the code in the 3 files right?
thanks alot
this is the def file. look ok?
does it need to go in librarys with the DLL?
this is the def file. look ok? does it need to go in librarys with the DLL?
The .def file is part or your compiled c++ solution. I then copy my compiled c++ dll into the system32 folder in windows. I use a 32 bit system with windows xp.
I'm no expert in c++ either, but this is how I was able to make it work.
thanks for the help, but still no.
werid thing is i tried making an EA with the usual code to check acc #:
int a = 907671;
int b = AccountNumber();
if (b != a) {
Alert("Checking Account No! (" + DoubleToStr(li_16, 0) + ") wrong Acc");
return (0)}
as an EA it loads no matter what the number is, but if i make it as an indi it works fine?
ggrrr
...
Your EA will always load (if it does not have a coding error that would prevent it to compile)
You just have to decide where do you want it to stop doing the "usual job" it does and prevent it from doing it for an unauthorized ones. Normally you put that checking routine at the beginning of the start() - something like this :
//| Dll_call.mq4 |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
static bool alerted = false;
int a = 907671;
int b = AccountNumber();
if (b != a)
{
if (!alerted)
{
Comment("Checking Account No! (" + DoubleToStr(b, 0) + ") wrong Acc");
alerted = true;
}
return (0);
}
//
//
// the part that is not executed when account number is wrong
//
//
alerted = false;
Comment("continuing the rest of the job");
return(0);
}
But also, this kind of checking is hackable by a decompiler in a matter of minutes.
PS: changed the Alert() to Comment() so you can check it in visual back test
thanks for the help, but still no.
werid thing is i tried making an EA with the usual code to check acc #:
int a = 907671;
int b = AccountNumber();
if (b != a) {
Alert("Checking Account No! (" + DoubleToStr(li_16, 0) + ") wrong Acc");
return (0)}
as an EA it loads no matter what the number is, but if i make it as an indi it works fine?
ggrrrSo you're great plan is to take two free EA's that you probably found here and 'merge' them together and sell it for 2K a pop? You've got some nerve buddy! Maybe if you're really lucky one of the two guys that actually gave up their time, effort and knowledge for free will offer to do it for you.
Oh but wait! If the code is 'messed up' then the EA's are mostly likely commercial EA's that have been decompiled. Is that it? Moron!!!
LuxOh, nice speech. Let me tell you this:
No matter what EA you're looking at, most likely there will be someone with the same idea already have the EA made. Free EA's? Are you kidding me? Which EA right on this forum had that potentials?
Also, there's alot of people calling themselves developers are also copying from others, selling for $3000 club subscriptions. And worst, with EA's that will blow your accounts flat. .... ZERO
Also, I had never took any EA's from here. Which EA is worth for the merge on this forum? Also, if the code is messed up, it could be me asking programmers to code an EA. Then as more features needed, I'm asking different programmers...TO HELP !
Different coding styles could over the time, messed up codes.
Also, I didn't decompile any commercial EA. The reason you said I am, is the fact that you're doing it yourself. I don't know what type of mess a decompiler will caused. But for sure, if you are so sure that a decompiler could caused a mess, then you've probably been using it. Otherwise you'd never know.
One advice, before calling others moron or try to act like a police / hero saving the day, judge yourself first. If not, those words coming from your mouth could forced you to swallow them back in.
Thank you.
Help regarding iMAOnArray()
Hi,
I'm new to MT4... I've been despeately trying to include the following piece of code in an expert but have been unable to do so
" iMAOnArray(ind_buffer1,Bars,SignalEMA,0,MODE_EMA,i); "
Yes, i know that the above can't be used directly in an EA, but is it possible to achieve same results by recoding the above MA? if so, i'd really appreciate some help on that.![](https://c.mql5.com/forextsd/smiles/teeth_smile.png)
Regards.