Amirio:
Hi all,
Been trying to find the lowest value of an EMA but this code doesnt seem to work.
Thx for the help.
Almost there , you need to calculate the moving average you are comparing against the lowest . The iMA calculates one value not an entire plot like Trading View
so your code becomes :
//get the first value of MA in the lowest double Lowest = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE,0); //loop inside the rest (from 1 instead of from 0) for (int i = 1; i < 10; i++) { //get the moving average at this location double MovingAverage = iMA(Symbol(), 0, 10, 0, MODE_EMA, PRICE_CLOSE,i); //if the moving average here is lower than the lowest value , we change ... if(MovingAverage < Lowest) { //...the lowest value Lowest=MovingAverage; } }
Hey Lorentzos,
Wow, thanks a lot.
Works perfectly.
Cheers,
Amir

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all,
Been trying to find the lowest value of an EMA but this code doesnt seem to work.
Thx for the help.