Decimal value for MACD - page 2

To add comments, please log in or register
danizani95
168
danizani95  
Ok thank you guys 
Fernando Carreiro
4958
Fernando Carreiro  
danizani95: Hi guys, I have a question.. Is it possible to set decimals value for a MACD ? for example : 12, 26, 7.5  Thanks
Alain Verleyen: Anyway, it's useless to change the input parameters from int to double. MACD is using Moving Average, and the parameters are the periods, it doesn't make sense to use non-integer values.
Keith Watford: There is no solution because there is no problem. Periods cannot be anything other than integers.

Even though I vowed not to post on the forum again (a promise which I have been breaking), I have to chime in here and say that both parties are partly correct and partly incorrect.

Some Moving Averages, like the SMA can only have "integer" periods, but others, like the EMA can technically have "floating point" periods, because the period is converted into a weight. In the case of EMA, the resulting weight for a floating point value for the period, is not only possible, but can also be useful and have a true effect on the resulting moving average.

For the SMMA and LWMA it can also be true, but depends on how they are implemented. For example, a SMMA can be implemented as a special case of an EMA, and in that case a floating point period is possible and useful. However, if the SMMA is implemented as a sum over a certain period, then only integer periods are possible. The same applies for LWMA depending on how it is implemented in the code.

For the MetaQuotes implementations, only the EMA would benefit from a floating point period, but for other custom implementations that use the weight based approach, all three - EMA, SMMA and LWMA, would benefit from floating point periods (if coded properly for such a possibility).

PS! So, in this case specifically, i.e. the MACD, the EMA parts would benefit from using floating point periods, but not the SMA part (as implemented by MetaQuotes, even though the original also uses an EMA for the signal line).

William Roeder
20055
William Roeder  
Keith Watford: Periods cannot be anything other than integers.
With the exception of EMA (and SMMA which is the same thing.)
Keith Watford
Moderator
19304
Keith Watford  
Fernando, what you say is true, but the MACD will not accept anything other than an integer. If you input a decimal number it will be changed to an integer.
Fernando Carreiro
4958
Fernando Carreiro  
Keith Watford: Fernando, what you say is true, but the MACD will not accept anything other than an integer. If you input a decimal number it will be changed to an integer.

Yes that is correct! That is why I stated "(if coded properly for such a possibility)" and that the MACD would "benefit" from a floating point period and not that it can accept such a value.

However, to clarify things for the OP, there are MACD implementations out there, that do accept "floating point" periods.

adam malik kasang
2014
adam malik kasang  

maybe, not pure MACD if you edit the value

Ernst Van Der Merwe
6582
Ernst Van Der Merwe  
.
Files:
G001
2829
G001  

U can read about how to do that here: svinozavr

12
To add comments, please log in or register