The slash should be a forward slash, not a backward slash.
Not \, but /
Not \, but /
Well I am now using iHigh() and iLow() which are the functions to do the 'periodwise' processing that I wanted. I found out about these
in some other thread (though you couldn't tell just by looking at the threads' title).
Anyway, the iHigh() and iLow() seem to work well and also I am putting my functions into Libraries - the only question I now have is:
Can you use global variables (declared in EA prior to any functions) in the Library functions?
When I tried it, the library file wouldn't compile - it said some error 'undeclared variable' or such.
I then tried to put in EXTERN directive but that didn't work either.
So the original question of how to launch a script from within an Expert Advisor I don't now need answered - it's just now
a theoretical question.
Cheers everybody.
BTW, The forward slash or backward slash issue - it doesn't matter, the compiler is happy with either, I tried both and both work.
in some other thread (though you couldn't tell just by looking at the threads' title).
Anyway, the iHigh() and iLow() seem to work well and also I am putting my functions into Libraries - the only question I now have is:
Can you use global variables (declared in EA prior to any functions) in the Library functions?
When I tried it, the library file wouldn't compile - it said some error 'undeclared variable' or such.
I then tried to put in EXTERN directive but that didn't work either.
So the original question of how to launch a script from within an Expert Advisor I don't now need answered - it's just now
a theoretical question.
Cheers everybody.
BTW, The forward slash or backward slash issue - it doesn't matter, the compiler is happy with either, I tried both and both work.
mab, about the globals: No, you cannot, but you can use MT4-wide globals (look in the help file). This is however VERY ugly coding, not to be recommended. Just supply them as parameters.

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
My question should be very basic but after reading the MQL4 docs and searching this forum I did not find an answer.
I have my Expert Advisor which needs to launch a script that I have writen and get result of the calculation. The reason why I want to use a script is that the EA is run 'tickwise' and I need to do my calculation 'periodwise' i.e. if I select H1 on my chart it needs to work hourly. My script will compare the current High[0] with previous bar's high High[1] (60 minutes ago) and maybe High[2] (120 minutes ago) and High[3] etc. I wrote the function in EA and it gave bogus results because it was comparing High[0] (this tick) with High[1] (previous tick) .i.e 'tickwise'.
My EA looks like this:
My script is in the experts\scripts directory and is called UpTrending.mq4
The script compiles fine. The EA also compiles fine. But I get a runtime error when running the EA:
cannot load library 'scripts\UpTrending' (error 126)
If I change the paths in the #import preprocessor directive I get same result.
If I leave out the #import altogether, the EA will not even compile! It gives:
UpTrending - function is not defined
Yet I don't have to declare or import the built-in indicators or built-in scripts, do I?
No doubt there is a simple answer, but I couldn't find it.
Please help.
BTW: the error 126 is not listed in stdlib.mqh so I don't even know what it is.
Oh, and if there is a different way to achieve 'periodwise' execution I'd be glad to hear it too.
Many thanx in advance.
Mark.