How can I make this SuperTrend indicator, with this ATR EMA indicator

 
Your topic has been moved to the section: Technical Indicators — In the future, please consider which section is most appropriate for your query.
MQL5 forum: Expert Advisors and Automated Trading
MQL5 forum: Expert Advisors and Automated Trading
  • www.mql5.com
How to create an Expert Advisor (a trading robot) for Forex trading
 

I'm going to redo this q:

How can I make this SuperTrend indicator, with this ATR - EMA indicator (supertrend uses ATR with MA and whant to change it for EMA)

 
Javier Santiago Gaston De Iriarte Cabrera #:

I'm going to redo this q:

How can I make this SuperTrend indicator, with this ATR - EMA indicator (supertrend uses ATR with MA and whant to change it for EMA)

Here I made it for you...


I simply used the iEma function created by a user here called Mladen Rakic

Files:
 

I added this custom logic where you can activate or deactivate the ATR (it's activated by default)

Enjoy...

Files:
deleteimg.png  9 kb
 
phade #:

I added this custom logic where you can activate or deactivate the ATR (it's activated by default)

Enjoy...

Is this using an ATR with exponential MA? where do I see the exponential ema?

 
Javier Santiago Gaston De Iriarte Cabrera #:

Is this using an ATR with exponential MA? where do I see the exponential ema?

Yes look at the bottom of the script, I included the "iEma" function which is for making the exponential moving average.


to change it from MA to EMA I simply change the middle band from this:

Middle[i]=(high[i]+low[i])/2;


to this (function call):

Middle[i] = iEma(close[i], EMA_Period, i, rates_total, 0);


On the ATR section I cleaned up the code, and allowed you to enable or disable the ATR with this:

    if(Activate_ATR){
       if(!CopyBuffer(atrHandle,0,0,to_copy,Atr)){
         Print("Atr failed! Error");
        }
    }
    else{
        ArrayResize(Atr, 0);
    }

which I thought would be a cool addition to turn it from a Supertrend indicator into a EMA, and back

 
phade #:
look at the bottom of the s

Thank you very much

I don't know why at this moment, have to look at it better ... but when using the indicator in the strat with the tester, mt5 hangs.

 
Javier Santiago Gaston De Iriarte Cabrera #:

Thank you very much

I don't know why at this moment, have to look at it better ... but when using the indicator in the strat with the tester, mt5 hangs.

I didn't find any hanging issues, maybe try restarting the application. Check your log files as well, they can go up to 500mb and will causes issues if they do, so you should delete them


File -> Open data folder -> logs