Short/LongCondition StandardLibrary

 

Hi everyone,

I have a small problem if anyone can help me, i build an EA with MQL5Wizard and i would like display the sum of pattern result of my signal.(Short and LongCondition result exactly)

In my Ontick function, i test this, but i have an error (folder0 is unknow):

void OnTick()
  {

   ExtExpert.OnTick();

   Print(filter0.LongCondition);

  }

And if i declare my signal objet in OnTick (CSignalSAR *filter0=new CSignalSAR;) filter0.LongCondition return always 0...

Have you an idea.

Thanks in advance.

(I'm a french MQL5 beginner developper, so forgive me for my English very light)

Aaliyan

 

Hi Aaliyan,

 

You are not using the inbuilt modules correctly. To start off I would suggest reading both these articles, and studying the code provided within:

 

https://www.mql5.com/en/articles/226

https://www.mql5.com/en/articles/367

 

They will give you an understanding of how to create an EA with the wizard, and use the LongCondition/ShortCondition methods.

MQL5 Wizard: How to Create a Module of Trading Signals
MQL5 Wizard: How to Create a Module of Trading Signals
  • 2011.01.11
  • MetaQuotes Software Corp.
  • www.mql5.com
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.
 
aaliyan:

Hi everyone,

I have a small problem if anyone can help me, i build an EA with MQL5Wizard and i would like display the sum of pattern result of my signal.(Short and LongCondition result exactly)

...

I know it's an old topic, but it's not really answered...

To print the value of ShortCondition/LongCondition for a signal module, you simply have to declare your filter0 (or filter1, filter2...) as global variable. I take the example of an EA build with the Wizard and based on SignalMA. Inside OnInit() function you have:

int OnInit()
  {
   ...
//--- Creating filter CSignalMA
   CSignalMA *filter0=new CSignalMA;
   ...
  }

You have to change this a little :

CSignalMA *filter0;

int OnInit()
  {
   ...
//--- Creating filter CSignalMA
   filter0=new CSignalMA;
   ...
  }

Then you can print the needed values in OnTick() :

void OnTick()
  {
   ExtExpert.OnTick();
   Print("filter 0 : Long= ",filter0.LongCondition(), " Short= ", filter0.ShortCondition());
  }

That give you :

2013.10.02 11:02:58    testMA (EURUSD,M5)    filter 0 : Long= 80 Short= 0

 

Interesting, and good information to boot.

Thank you for this discussion.

Reason: