Combine indicators and multiple periods in EA: next steps

 

Hello,

I have multiple indicators and various periods that I take into account to enter and exit a trade. What are the steps to put them together in an EA so that when conditions are right I enter or exit a trade? Can I use an existing library or template where I point to my various indicators and time frames to be read? Do I create a separate class for every indicator in the EA to be read? I have all the data and just want to put it together.

Thank you for your help. 

 
zeno:

Hello,

I have multiple indicators and various periods that I take into account to enter and exit a trade. What are the steps to put them together in an EA so that when conditions are right I enter or exit a trade? Can I use an existing library or template where I point to my various indicators and time frames to be read? Do I create a separate class for every indicator in the EA to be read? I have all the data and just want to put it together.

Thank you for your help. 

There is the standard library, and eventually MQL5 Wizard. Otherwise you just have to put it together, your question is vague.
Documentation on MQL5: Standard Library
Documentation on MQL5: Standard Library
  • www.mql5.com
Standard Library - Documentation on MQL5
 
angevoyageur:
There is the standard library, and eventually MQL5 Wizard. Otherwise you just have to put it together, your question is vague.

Sorry, let me be more specific. Let's assume indicators A and B (e.g. ultra RSI and parabolic SAR) and possibly a 3rd one. They provide buy and sell signals, and if they both provide a signal (e.g. to buy) on the 1st bar closed within a certain time frame (e.g. within 10 minutes) of each other, on both the 5 and 15 minutes charts (as example), I put in a buy order (calculated on closed bar). In summary, if both indicators on 2 chart periods provide a buy signal within time frame (of 10 minutes), this is a confirmation to buy. I hope this example makes it clearer?

So I have those signals on these charts.  Indeed, the standard library among others refers to technical indicators (in general), but would it not be easier to refer to those signals that I have already set up? Also, I looked into managing multiple time frames as I describe in the line above, but did not see anything related to this combination (with multiple indicators). Did I oversee something?

Thank you. 

 
zeno:

Sorry, let me be more specific. Let's assume indicators A and B (e.g. ultra RSI and parabolic SAR) and possibly a 3rd one. They provide buy and sell signals, and if they both provide a signal (e.g. to buy) on the 1st bar closed within a certain time frame (e.g. within 10 minutes) of each other, on both the 5 and 15 minutes charts (as example), I put in a buy order (calculated on closed bar). In summary, if both indicators on 2 chart periods provide a buy signal within time frame (of 10 minutes), this is a confirmation to buy. I hope this example makes it clearer?

So I have those signals on these charts.  Indeed, the standard library among others refers to technical indicators (in general), but would it not be easier to refer to those signals that I have already set up? Also, I looked into managing multiple time frames as I describe in the line above, but did not see anything related to this combination (with multiple indicators). Did I oversee something?

Thank you. 

Hi zeno, it's very clear what you want, but note that there are several options and steps to put these indicators together in an EA, so that when conditions are right you will enter or exit a trade, like you need.

In other words, this options here are the algorithm you must code, like any other EA.

Maybe your doubt is how to code this algorithm (for instance using neural networks, state machines, etc.),so  please describe better what are you thinking about.

 
figurelli:

Hi zeno, it's very clear what you want, but note that there are several options and steps to put these indicators together in an EA, so that when conditions are right you will enter or exit a trade, like you need.

In other words, this options here are the algorithm you must code, like any other EA.

Maybe your doubt is how to code this algorithm (for instance using neural networks, state machines, etc.),so  please describe better what are you thinking about.

I thought to develop the algorithm in C++ since MQL5 is close to it. I can define every component (indicator/time frame) as a class or function in this design. I have not considered NN or state machine since I'm not familiar with them.
 
zeno:
I thought to develop the algorithm in C++ since MQL5 is close to it. I can define every component (indicator/time frame) as a class or function in this design. I have not considered NN or state machine since I'm not familiar with them.

So standard library and wizard, as suggested by Alain below, is the way.

Maybe research some free source code ideas (code base here)  can help you too.

Documentation on MQL5: Standard Library
Documentation on MQL5: Standard Library
  • www.mql5.com
Standard Library - Documentation on MQL5
 

i have the same issue. i want to combine parabolic sar and relative strenght index. the condition is that when both criteria are met, a buy or sell signal is triggered. the problem the mql5 wizard mechanism add the 2 indicators together it is not an and /or condition.

plain english lol this is waht the ea should do

if the criteria to trigger entry for the parabolic sar is met, it should then go on to check if the criteria set for realstive strenght index is met. and only if both conditions are met is a buy or sell signal to be triggered.


look forward to your input. the parabolic sar on it's own is not quite accurate

 

This might help

if (IsBarOpenEvent()) {
   // get the leading ALMA trend
   int trendALMA = iCustom("ALMA", ..., MovingAverage_MODE_TREND, 1);
 
   // get the following SuperTrend trend
   int trendSuper = iCustom("SuperTrend", ..., MovingAverage_MODE_TREND, 1);
 
   if      (trendALMA > 0 && trendSuper == 1) twoSignals(MODE_UPTREND);
   else if (trendALMA < 0 && trendSuper == -1) twoSignals(MODE_DOWNTREND);
}
 
void twoSignals(int direction) {
   if (direction == MODE_UPTREND) {
      // go long
   }
   else {
      // go short
   }
}

Reason: