Experts: Universal Signals & Universal Trailing Modules

 

Universal Signals & Universal Trailing Modules:

This is a module for MQL5 Wizard and Standard Library, which allows you to generate expert adviser based on arbitrary set of indicators and conditions.

Author: Stanislav Korotky

 

Good time of the day! I downloaded the Indicator and the Expert Advisor, set the settings as in your article, but by pressing the OK button, the Expert Advisor is removed from the chart and nothing happens.

It gives the following error in the log

2023.05.29 14:37:14.716 Experts initializing of UniversalSignalDemo (EURUSD,M15) failed with code 1
2023.05.29 14:37:14.728 Experts expert UniversalSignalDemo (EURUSD,M15) removed

What could be the reason?

Files:
q085uq2.JPG  40 kb
cxk71g.JPG  144 kb
byr8qv1.JPG  138 kb
 
FINANSE-BOND #:
Good time of the day! I downloaded the Indicator and the Expert Advisor, set the settings as in your article, but by pressing the OK button, the Expert Advisor is removed from the chart and nothing happens.

It gives the following error in the log

2023.05.29 14:37:14.716 Experts initializing of UniversalSignalDemo (EURUSD,M15) failed with code 1

2023.05.29 14:37:14.728 Experts expert UniversalSignalDemo (EURUSD,M15) removed

What could be the reason?

You did not provide the logs from Expert tab, which is the most important thing for troubleshooting. I have a look at it myself.

First of all, you did not provide info which settings exactly you mean. If it's about the set-file with a custom silver trend indicator, you should make sure the indicator is in place and compiled. Otherwise, your signal can not be configured properly during OnInit, when the indicator is created.

Second, it looks like MQ guys broke compiler with some cases of [mis-]initialization of global instances of objects (which is used in the code).

Until they have a look on it and fix it, I hardly can help. But I'll try to find a workaround.

 

Try this one (the archive contains all files, including the updated). It works for me.

Tester chart with UniversalSignalDemo

initial deposit 10000.00 USD, leverage 1:100
successfully initialized
...
2023.01.01 00:00:00   Attached SymbolProps funcs:ASK;BID;LAST;LASTVOLUME;
2023.01.01 00:00:00   Attached Series funcs:TIME;OPEN;HIGH;LOW;CLOSE;VOLUME;REALVOLUME;SPREAD;
2023.01.01 00:00:00   Initializing iCustom_ silvertrend_signal@0()[1]
2023.01.01 00:00:00   Initializing iCustom_ silvertrend_signal@1()[1]
2023.01.01 00:00:00   Initializing iMA_period_shift_method_price @(14,0,ema,typical)[1]
2023.01.01 00:00:00   Analyzing condition A sell by silvertrend (1) ExpressionByIndicatorX
2023.01.01 00:00:00   98566144 `  0.000000 -1  [96468992 97517568]
2023.01.01 00:00:00    96468992 f  0.000000 30 (IND1) [94371840 95420416]
2023.01.01 00:00:00     94371840 n  1.000000 -1  [0 0]
2023.01.01 00:00:00     95420416 n  0.000000 -1  [0 0]
2023.01.01 00:00:00    97517568 n  0.000000 -1  [0 0]
2023.01.01 00:00:00   Analyzing condition B buy by silvertrend (2) ExpressionByIndicatorX
2023.01.01 00:00:00   105906176 `  0.000000 -1  [103809024 104857600]
2023.01.01 00:00:00    103809024 f  0.000000 30 (IND1) [101711872 102760448]
2023.01.01 00:00:00     101711872 n  1.000000 -1  [0 0]
2023.01.01 00:00:00     102760448 n  1.000000 -1  [0 0]
2023.01.01 00:00:00    104857600 n  0.000000 -1  [0 0]
2023.01.01 00:00:00   Analyzing condition C buy by gap ExpressionByIndicatorX
2023.01.01 00:00:00   123731968 >  0.000000 -1  [115343360 122683392]
2023.01.01 00:00:00    115343360 -  0.000000 -1  [111149056 114294784]
2023.01.01 00:00:00     111149056 f  0.000000 33 (OPEN) [110100480 0]
2023.01.01 00:00:00      110100480 n  0.000000 -1  [0 0]
2023.01.01 00:00:00     114294784 f  0.000000 34 (CLOSE) [113246208 0]
2023.01.01 00:00:00      113246208 n  1.000000 -1  [0 0]
2023.01.01 00:00:00    122683392 *  0.000000 -1  [120586240 121634816]
2023.01.01 00:00:00     120586240 -  0.000000 -1  [117440512 119537664]
2023.01.01 00:00:00      117440512 f  0.000000 35 (ASK) [0 0]
2023.01.01 00:00:00      119537664 f  0.000000 36 (BID) [0 0]
2023.01.01 00:00:00     121634816 n  10.000000 -1  [0 0]
2023.01.01 00:00:00   Analyzing condition D sell by gap ExpressionByIndicatorX
2023.01.01 00:00:00   137363456 <  0.000000 -1  [131072000 136314880]
2023.01.01 00:00:00    131072000 -  0.000000 -1  [127926272 130023424]
2023.01.01 00:00:00     127926272 f  0.000000 33 (OPEN) [126877696 0]
2023.01.01 00:00:00      126877696 n  0.000000 -1  [0 0]
2023.01.01 00:00:00     130023424 f  0.000000 34 (CLOSE) [128974848 0]
2023.01.01 00:00:00      128974848 n  1.000000 -1  [0 0]
2023.01.01 00:00:00    136314880 *  0.000000 -1  [134217728 135266304]
2023.01.01 00:00:00     134217728 -  0.000000 -1  [132120576 133169152]
2023.01.01 00:00:00      132120576 f  0.000000 36 (BID) [0 0]
2023.01.01 00:00:00      133169152 f  0.000000 35 (ASK) [0 0]
2023.01.01 00:00:00     135266304 n  10.000000 -1  [0 0]
2023.01.01 00:00:00   Analyzing condition E Trailing stop by MA NotEmptyIndicatorX
2023.01.01 00:00:00   Indicators specified: 3
2023.01.01 00:00:00   Indicators successfully initialized: 3
2023.01.01 00:00:00   Conditions successfully initialized: 5
2023.01.03 02:00:00   instant buy 0.1 EURUSD at 1.06763 sl: 1.06263 (1.06762 / 1.06763 / 1.06762)
2023.01.03 02:00:00   deal #2 buy 0.1 EURUSD at 1.06763 done (based on order #2)
2023.01.03 02:00:00   deal performed [#2 buy 0.1 EURUSD at 1.06763]
2023.01.03 02:00:00   order performed buy 0.1 at 1.06763 [#2 buy 0.1 EURUSD at 1.06763]
2023.01.03 02:00:00   CTrade::OrderSend: instant buy 0.10 EURUSD at 1.06763 sl: 1.06263 [done at 1.06763]
2023.01.03 03:00:00   position modified [#2 buy 0.1 EURUSD 1.06763 sl: 1.06686]
2023.01.03 03:00:00   CTrade::OrderSend: modify position #2 EURUSD (sl: 1.06686, tp: 0.00000) [done]
2023.01.03 03:00:40   stop loss triggered #2 buy 0.1 EURUSD 1.06763 sl: 1.06686 [#3 sell 0.1 EURUSD at 1.06686]
2023.01.03 03:00:40   deal #3 sell 0.1 EURUSD at 1.06686 done (based on order #3)
2023.01.03 03:00:40   deal performed [#3 sell 0.1 EURUSD at 1.06686]
2023.01.03 03:00:40   order performed sell 0.1 at 1.06686 [#3 sell 0.1 EURUSD at 1.06686]
2023.01.04 04:00:00   instant buy 0.1 EURUSD at 1.05668 sl: 1.05168 (1.05667 / 1.05668 / 1.05667)
2023.01.04 04:00:00   deal #4 buy 0.1 EURUSD at 1.05668 done (based on order #4)
2023.01.04 04:00:00   deal performed [#4 buy 0.1 EURUSD at 1.05668]
2023.01.04 04:00:00   order performed buy 0.1 at 1.05668 [#4 buy 0.1 EURUSD at 1.05668]
2023.01.04 04:00:00   CTrade::OrderSend: instant buy 0.10 EURUSD at 1.05668 sl: 1.05168 [done at 1.05668]
...
2023.05.26 01:00:00   deal #276 buy 0.1 EURUSD at 1.07284 done (based on order #276)
2023.05.26 01:00:00   deal performed [#276 buy 0.1 EURUSD at 1.07284]
2023.05.26 01:00:00   order performed buy 0.1 at 1.07284 [#276 buy 0.1 EURUSD at 1.07284]
2023.05.26 01:00:00   CTrade::OrderSend: instant buy 0.10 EURUSD at 1.07284 sl: 1.06784 [done at 1.07284]
2023.05.26 02:00:00   position modified [#276 buy 0.1 EURUSD 1.07284 sl: 1.07257]
2023.05.26 02:00:00   CTrade::OrderSend: modify position #276 EURUSD (sl: 1.07257, tp: 0.00000) [done]
2023.05.26 02:01:40   stop loss triggered #276 buy 0.1 EURUSD 1.07284 sl: 1.07257 [#277 sell 0.1 EURUSD at 1.07257]
2023.05.26 02:01:40   deal #277 sell 0.1 EURUSD at 1.07257 done (based on order #277)
2023.05.26 02:01:40   deal performed [#277 sell 0.1 EURUSD at 1.07257]
2023.05.26 02:01:40   order performed sell 0.1 at 1.07257 [#277 sell 0.1 EURUSD at 1.07257]
final balance 10222.73 USD
Files:
 
Stanislav Korotky #:

Try this one (the archive contains all files, including the updated). It works for me.

The files from the new archive were installed immediately without errors and the Expert Advisor started working right away.

So you need to replace the original archive in the post you published.

 
Here is a slightly improved archive. It's easier for users to download from this archive, because updates of the files in the original post does not update archive there (this is a long time known issue of the site).
Files:
Reason: