Download MetaTrader 5
To add comments, please log in or register
Articles have already helped many traders. Come and read them!
fxtrader_
247
fxtrader_ 2015.09.25 00:36 

Hi All,


How can I find the distance between moving average and current low?


What is the formula used for that.?

Thank for any help.
Sherif Hasan
7223
Sherif Hasan 2015.09.25 05:12  
FxTrader_:


Hi All,


How can I find the distance between moving average and current low?


What is the formula used for that.?

Thank for any help.
iMA(NULL, 0,14,0,MODE_SMA,PRICE_CLOSE,0)-Low[0];
fxtrader_
247
fxtrader_ 2015.09.25 08:33  

Hi Sheriff,

Thank you for you asistance, BUT the above code it show more than 8 digets.

I need it to show only the Result.



Thank u for help.

honest_knave
969
honest_knave 2015.09.25 09:51  

You just need to modify the output to show the desired precision: 

   double diff=iMA(NULL, 0,14,0,MODE_SMA,PRICE_CLOSE,0)-Low[0];
   Print(DoubleToStr(diff,Digits));
fxtrader_
247
fxtrader_ 2015.09.25 10:07  

Thank your for your assistance,


But I'm not able to show it in the screen,


Regards
honest_knave
969
honest_knave 2015.09.25 11:04  

Print statements will only appear in the log - I just used it as an example.

If you need it somewhere else (e.g. in a text or label), the logic remains the same: use StringFormat or DoubleToStr to define the precision.

You haven't posted your code so we're all shooting blind here... 

fxtrader_
247
fxtrader_ 2015.09.25 11:10  
Thank you so much
/
To add comments, please log in or register