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

 

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. 

 

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);
//----
  }

 
Thank you so much.
Reason: