If you trade like me, you'll be homeless and broke within a week.
Goldilocks All Time Return:
96.2%
Enoch likes indicator scripts and trading logs as well as insight 4 replies
Modify Indicator to run scripts? Please Help 0 replies
Calling Scripts from another file 5 replies
Calling to all Programmers! let's remake this 123 indicator 1 reply
Disliked...It works fine if the script is in the root directory but if I put it in a subfolder ... it can't seem to find the script...Ignored
Disliked...DebugView manages to print the file not found error from LoadMQLProgram (see attached). It seems that the function tries to search for my script in the installation directory where terminal.exe is located instead of in the MT4 Data folder...Ignored
// MQL program types #define PT_INDICATOR 1 #define PT_EXPERT 2 #define PT_SCRIPT 4 bool LoadMqlProgramW(int hChart, PT_EXPERT, string name); // relative to "MQL4/Experts" bool LoadMqlProgramW(int hChart, PT_INDICATOR, string name); // relative to "MQL4/Indicators" bool LoadMqlProgramW(int hChart, PT_SCRIPT, string name); // relative to "MQL4/Scripts"
string path = "C:\\Users\\ME\\AppData\\Roaming\\MetaQuotes\\Terminal\\1DAFD9A7C67DC84FE37EAA1FC1E5CF75\\MQL4\\Scripts\\subfolder Scripts\\"; int hChart = WindowHandle(Symbol(), NULL); bool result = LoadMqlProgramW(hChart, PROGRAMTYPE_SCRIPT, path + "filename"); if(result)Print("file retrieved successfully"); else Print("file retrieval not successful - " + string(GetLastError()));
#define PROGRAMTYPE_SCRIPT 4 string name = "subfolder\\ClosePositions"; int hChart = WindowHandle(Symbol(), NULL); bool result = LoadMqlProgramW(hChart, PROGRAMTYPE_SCRIPT, name);
Disliked{quote} Yes. You can only launch programs located in the MQL4 folder of the currently running terminal, so it makes no sense to point somewhere with an absolute path. As explained above you pass the path "relative to the containing program type folder". For scripts this means relative to "MQL4/Scripts". For example if your script is named "ClosePositions" and is located in a subfolder named "subfolder" then you call the function like so: #define PROGRAMTYPE_SCRIPT 4 string name = "subfolder\\ClosePositions"; int hChart = WindowHandle(Symbol(), NULL);...Ignored
2021.07.30 19:13:58.363 2021.03.01 16:30:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:56.128 2021.03.01 16:15:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieved successfully 2021.07.30 19:13:53.883 2021.03.01 16:00:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:51.640 2021.03.01 15:45:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:49.418 2021.03.01 15:30:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:47.161 2021.03.01 15:15:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:44.940 2021.03.01 15:00:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:42.705 2021.03.01 14:45:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:40.461 2021.03.01 14:30:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:38.210 2021.03.01 14:15:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:35.980 2021.03.01 14:00:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:33.731 2021.03.01 13:45:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:31.490 2021.03.01 13:30:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:29.267 2021.03.01 13:15:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:27.020 2021.03.01 13:00:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0 2021.07.30 19:13:24.792 2021.03.01 12:45:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieved successfully 2021.07.30 19:13:22.531 2021.03.01 12:30:00 Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0
Disliked...I have a new problem that the script is called too often. It supposed to be called only once when previously there was an upsignal (upsignal generated when price was above upper limit; downsignal generated when price was below lower limit and price comes back below the upper channel, then it should do nothing until the opposite signal job was done after calling the script I did set the signal to empty... why the indi still calling script so many times?...Ignored
DislikedI apply similar in another indi why result like this:
...Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0
...Schaff Trend v2.02 trade GBPUSD,M15: file retrieved successfully
...Schaff Trend v2.02 trade GBPUSD,M15: file retrieval not successful - 0
WhyIgnored
Disliked...it reported...GBPUSD,M1: file retrieved successfully but not doing the job what script supposes to do. I test by attaching the script to chart manually, script does send the order to demo account successfully...Ignored
Disliked(1) {quote} You have an issue with the conditions in your code and the call repeats. As this is your code unfortunately I can't help you with it. (2) {quote} During the same run sometimes execution succeeds and sometimes not. Please install DebugView from here or here. At the first link there are some filters which may be used to see only MetaTrader related stuff in the output. Start DebugView...Ignored
Disliked(1) {quote} You have an issue with the conditions in your code and the call repeats. As this is your code unfortunately I can't help you with it. (2) {quote} During the same run sometimes execution succeeds and sometimes not. Please install DebugView from here or here. At the first link there are some filters which may be used to see only MetaTrader related stuff in the output. Start DebugView...Ignored
Disliked...then I run the strategy tester, load the indicator TMa etc, which should call the trade script...To be sure that the script does its job I attach it manually to chart and can see order is sent...Ignored
Disliked...the new rsfMT4Expander.dll must be hidden as zip or data file, else I can not download from github, it reports file could harm my PC, and block download...Ignored
Disliked...In the terminal log I can see file retrieval successful. But in the debugview it is empty, nothing to send to you...Ignored
Disliked...the debugview's help file I open with edge just appeared to be empty although it is 67 kB. So it does not help...Ignored
DislikedHopefully my following remarks will help: {quote} You cannot run trade execution scripts in Strategy Tester, neither manually nor automated (via my script caller). The script will execute the trade commands always in your online account (demo or real), never in the tester context. The only way to execute trade commands in tester is via experts. {quote} This is a known browser issue with latest versions of Chrome and/or Edge. Of course a DLL file can never harm a computer, except if one uses Microsoft Edge in which case everything can (and will)...Ignored
QuoteDislikedLet me make a wild guess: The Expander will call your script in tester but your trade command will be executed on your online account. As you have no error handling in your script you just don't notice that the trades fail. Why? Because it's weekend and the market is closed. If I'm right you are very lucky. During the week your "supposed test trades" could have gone into your real account - without you even noticing.
Disliked...I have replaced the rsfMT4Expander.dll in MQL4\Libraries I edited in the filter like in your screen capture with "Metatrader;Tester;Expander". I stopped and restarted Metatrader, then ran tester, still nothing is captured!...Ignored
Disliked...when I did run debugview the first time, about the time I answered first time to our conversation, debugview captured also nothing, so I left it running still, then 17:29 something is happening and it did capture system msg what I attach here...Ignored
Disliked{quote} This means you don't call the DLL at all. If you don't get at least the first logmessage as seen in my last screenshot, then the DLL is never called. Either your #import statement or the call are wrong, and you didn't check for errors. MetaTrader would give you an error if you try to call a DLL and it fails. Back to the last paragraph of #54 please. {quote} These are debug messages from other programs/services running on your machine. The purpuse of the include filter...Ignored