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

 

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

 
Good stuff... well written and certainly an eye opener.

 

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
 
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

 
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?
 
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.
 
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

 

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

 

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                                          |

 

 
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!
 

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!!

Reason: