Download MetaTrader 5

Usage of Signal-Classes

To add comments, please log in or register
Owen Fausd
Owen Fausd  
Hello everyone,

I tried to setup an Expert-Advisor in mql5 trading with several Indicator-Signals using the Signal-Classes from StdLib.

I've searched a lot for examples, but can only find complete Trading-Systems with objects of "CExpert" (propably just made with a wizard).

But I cannot find any simple discriptions of the proper usage of those Signal-Classes.

For Example I want to use "CSignalMACD" from "Expert/Signal/SignalMACD.mqh":

I just want to create an Object like

CSignalMACD* sm = new CSignalMACD();

and use the calculated signals, be something like:

    if     (sm.LongCondition()) buy();
    else if(sm.ShortCondition()) sell();

I know that most time I have to call some kind of calculate-method. For indicator-classes like "CiBands" it is the method "Refresh()"

Could please anybody tell me what methods I actually have to call to receive the signals?

For the Bollinger-Indicator it is easy:

#include <Indicators/Trend.mqh>
CiBands bo;


  bo.Create(_Symbol, PERIOD_CURRENT, 500, 0, 1.5, PRICE_CLOSE);



  upp = bo.Upper(0);

  base = bo.Base(0);

  low = bo.Lower(0);


This all works without Problems. I found out, that the methods "Create(...)" and "Refresh()" are essencial.

But how can I use the Signal-Classes like "CSignalRSI" in this way? Which methods do I need?
If it is a language provided function or object, usually the best place to find out how to use them is on their doc page.  If it is a custom built one, then you should see if the person who built it made a doc page.
Owen Fausd
Owen Fausd  

There are 20 Classes in the folder. Each one with this headline:

//|                   Copyright 2009-2013, MetaQuotes Software Corp. |

//|                                     |

I have searched for a long time.

All I can find are some simple descriptions on how to use a wizard to create an EA

or super-simple documentation like this one

I tried a lot meanwhile by analyzing code, base-classes and just testing diffrent ideas.

Seems like you have to create Objects for Open, High, Low, Close and maybe spread, volume and time.

There are the methods SetPriceSeries(...) and SetOtherSeries(...) to pass those values.

also you propably have to call InitIndicators(...) with a new Pointer to an "Indicators"-Object ...

I receive some Values from LongCondition() and ShortCondition() that way, but are the correct?

Did no one ever use those classes? Is there any documentation-site, where the proper use is discribed?

Automated Trading and Strategy Testing
Automated Trading and Strategy Testing
MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions
Owen Fausd
Owen Fausd  

I work with those classes now, because that way I get some signals.

But could anybody please tell me, if this initialisation is correct?

Maybe I forgot something and use wrong signals ...

To add comments, please log in or register