TheLobos: In my rlib.h file (located under "...\MQL4\Include" I do the following): #import "rlib.ex4" int subGetMagicNumber(int iMagic, string sSymbol, int iTimeFrame);
Then in my rlib.mq4 (located under "...\MQL4\LIbraries) I do the following: #property copyright "xxx" int subGetMagicNumber (int iMagic, string sSymbol, int iTimeFrame) { < ... some code goes here ... > return (StrToInteger(StringConcatenate(iMagic, iSymbol, iTimeFrame))); }
Finally in my main EA code I do the following:
#property copyright "xxx" #property link "xxx" #include <stdlib.mqh> #include <rlib.mqh> #import "rlib.ex4" static int _iPeriod = 0; static string _sSymbol = ""; string _iMagicNumber = 0; int init () { _sSymbol = Symbol (); _iPeriod = Period (); _iMagicNumber = subGetMagicNumber (MagicNumber, _sSymbol, _iPeriod); |
|
|
|
This is actually a really good point. Doing it this way resolved everything in about 5 seconds. THANKS!
This is actually a really good point. Doing it this way resolved everything in about 5 seconds. THANKS!
What are you babbling about? The OP did thank me, and you quoted it.
I think that that "Doerk" is feeling a little "unappreciated" because the OP did not thank him as well for his posts.
@Doerk: I don't think that the OP meant any disrespect and was just happy that his problem was solved via a method that required the least amount of effort on his part, which just so happened to have been suggested by "WHRoeder".
As for the Q&A, whether you like it or not, forums do tend to be exactly that.
@WHRoeder - I am surely not "babbling", ok?
@FMIC - its absolutely ok that one takes the part which suits the needs best, of course. But a part of good behaviour is to recognize the actual answer one searched for and at least to thank for that. I dont think that I am that very wrong at this point.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm trying to group some common functions into a library of my own and for some silly reason can't get things to work.
In my rlib.h file (located under "...\MQL4\Include" I do the following):
#property copyright "xxx"
#property link "xxx"
#import "rlib.ex4"
int subGetMagicNumber(int iMagic, string sSymbol, int iTimeFrame);
Then in my rlib.mq4 (located under "...\MQL4\LIbraries) I do the following:
#property copyright "xxx"
#property link "xxx"
#property library
#import "rlib.ex4"
#include <stdlib.mqh>
#include <rlib.mqh>
{
< ... some code goes here ... >
return (StrToInteger(StringConcatenate(iMagic, iSymbol, iTimeFrame)));
}
Finally in my main EA code I do the following:
#property link "xxx"
#include <stdlib.mqh>
#include <rlib.mqh>
#import "rlib.ex4"
static string _sSymbol = "";
string _iMagicNumber = 0;
{
_sSymbol = Symbol ();
_iPeriod = Period ();
_iMagicNumber = subGetMagicNumber (MagicNumber, _sSymbol, _iPeriod);
Yet my EA dies with the following error:
Can not find subGetMagicNumber in rlib.ex4
Unresolved import function call
Does anybody have any idea what I'm doing wrong here?