Download MetaTrader 5

Discussion of article "MQL5 Wizard: How to Create a Module of Trading Signals"

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
182618
MetaQuotes Software Corp. 2011.01.11 14:47 

New article MQL5 Wizard: How to Create a Module of Trading Signals is published:

The article discusses how to write your own class of trading signals with the implementation of signals on the crossing of the price and the moving average, and how to include it to the generator of trading strategies of the MQL5 Wizard, as well as describes the structure and format of the description of the generated class for the MQL5 Wizard.

Figure 1. The structure of the CExpert base class

Author: MetaQuotes

Stephen Njuki
5180
Stephen Njuki 2011.01.16 22:40  
Good stuff... well written and certainly an eye opener.

Stephen Njuki
5180
Stephen Njuki 2011.01.19 14:09  

I have a question.

How do you send buy stop limit or sell stop limit orders with the inbuilt classes if you are creating your own module? Cannot find provision for stoplimit price

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
Automated-Trading
Admin
101216
Automated-Trading 2011.01.19 14:56  
ssn:

How do you send buy stop limit or sell stop limit orders with the inbuilt classes if you are creating your own module? Cannot find provision for stoplimit price

The order type (limit or stop) depends on price.

For example, to trade using buy stop orders you must specify the price, higher than current ask price.

The buy case (in CheckOpenLong):


For the case of the price inside the freeze level it will use the market price.

See example in MQL5 Wizard - Trade Signals Based on Crossover of Two EMA with intraday time filter

Stephen Njuki
5180
Stephen Njuki 2011.01.19 16:47  
Automated-Trading:

The order type (limit or stop) depends on price.

For example, to trade using buy stop orders you must specify the price, higher than current ask price.

The buy case (in CheckOpenLong):


For the case of the price inside the freeze level it will use the market price.

See example in MQL5 Wizard - Trade Signals Based on Crossover of Two EMA with intraday time filter

Hey I actually wrote buy_stop_limit and sell_stop_limit orders. Now yes you are right the price variable for each of these will be above Ask plus maximum of freeze and stops & below bid minus maximum of the same respectively. My question is how do we set the stoplimit price?
Automated-Trading
Admin
101216
Automated-Trading 2011.01.19 18:22  
ssn:
Hey I actually wrote buy_stop_limit and sell_stop_limit orders. Now yes you are right the price variable for each of these will be above Ask plus maximum of freeze and stops & below bid minus maximum of the same respectively. My question is how do we set the stoplimit price?
Ok, now I see. The Buy Stop Limit and Sell Stop Limit orders are not used by CExpert (such orders may be useful for non-liquid stocks), so you need to write your own implementation.
Stephen Njuki
5180
Stephen Njuki 2011.01.19 20:03  
Automated-Trading:
Ok, now I see. The Buy Stop Limit and Sell Stop Limit orders are not used by CExpert (such orders may be useful for non-liquid stocks), so you need to write your own implementation.

Non liquid stocks?... just testing EURUSD over a decade with stop limit orders and this strategy clearly outperforms the limit order option. Any way I hope metaquotes can provide an implementation to go with this not too bad library.

Thanks for the feedback

Mario Semper
238
Mario Semper 2012.01.10 15:46  

Hi,

i followed all steps in the article, but i got it not work.

I saved the signal in the files \include\expert\signal\mysignals\samplesignal.mqh.

But it isn't recognized by the meta editor. I tried the same with the attached file in the article, no change...


My current Meta Editor version is 5.00 Build 567


Any ideas?


Thanks Mario

yankai0219
4
yankai0219 2012.03.26 09:20  

when  I use the file that you attached to the article,there is something wrong. 

I find the comment about Type should be as follows:

//| Type=SignalAdvanced                                          |

 

Rashid Umarov
Admin
11994
Rashid Umarov 2012.03.26 10:50  
yankai0219:

when  I use the file that you attached to the article,there is something wrong. 

I find the comment about Type should be as follows:

//| Type=SignalAdvanced                                          |

 

You can read that in the article Create Your Own Trading Robot in 6 Steps!
trolley
37
trolley 2012.12.15 00:33  

Hi All,

I downloaded the signal from this article and created a MQ5 using the wizard, but the EA does not make any trades. Any ideas?

I had to make the change in the above comments to get the signal to show up in the list, apart from that it compiled OK. Running the EA in the strategy tester does not do anything though :( 

 

EDIT: After inserting print statements in all CSampleSignal class functions, and CExpertSignal class functions, it appears as if the inherited functions are not being overwritten by the CSampleSignal functions-

i.e. in this example, instead of these executing: 

class CSampleSignal : public CExpertSignal
  {
	bool CSampleSignal::CheckOpenLong(double& price,double& sl,double& tp,datetime& expiration);
	bool CSampleSignal::CheckOpenShort(double& price,double& sl,double& tp,datetime& expiration);

 

The following are executed:

class CExpertSignal : public CExpertBase
  {
	virtual bool     CheckOpenLong(double& price,double& sl,double& tp,datetime& expiration);
	virtual bool     CheckOpenShort(double& price,double& sl,double& tp,datetime& expiration);

Does that make sense? The functions from the parent class are being executed, when they are being overwritten in the child class ... Any help would be greatly appreciated!!

12
To add comments, please log in or register