Download MetaTrader 5

How to get values ​​from the indicator ( WPR && EMA in WPR)

To add comments, please log in or register
Do you want to learn MQL5? 300 articles will help you!
Kiattiphoom Pitugsmeka
20
Kiattiphoom Pitugsmeka 2014.06.29 22:16 

Hello, 

 

If I want to bring out the value of the EMA. 

How to write code?  

The default setting is William Period: 5 

EMA: 3

Thanks. 

Roberto Jacobs
46469
Roberto Jacobs 2014.06.30 15:53  

Hello,

You can try this code:

double EMAValue()
  {
//---
     int limit=WindowFirstVisibleBar(); 
     double wpr[];
     ArrayResize(wpr,limit);
     ArraySetAsSeries(wpr,true);
     //--
     for(int i=limit; i>=0; i--)
       {
          wpr[i]=iWPR(_Symbol,0,5,i);
       }
     //--
     double wprplus=100-MathAbs(wpr[i]); // If you want to Convert the Minus WPR value to Plus
     double ema=iMAOnArray(wpr,0,3,0,MODE_EMA,0)); // The real value of EMA3 (EMA3 Minus)
     double emaplus=100-MathAbs(iMAOnArray(wpr,0,3,0,MODE_EMA,0)); // If you want to convert the Minus EMA3 value to Plus
     //--
     return(ema);
     // or return(emaplus);
//----
  }

Kiattiphoom Pitugsmeka
20
Kiattiphoom Pitugsmeka 2014.06.30 17:23  
Thank you so much.
To add comments, please log in or register