/  Forum 

Alert and Comment for External Indicators (Part Two) Since I published the article "Alert and Comment for External Indicators", I have been receiving requests and questions regarding the possibility of developing an external informer operating based on indicator lines. Having analyzed the questions, I have decided to continue with the subject. Getting data stored in indicator buffers turned out to be another area of interest to users. 


3827: Hi All: We have DEMA, TEMA, AMA and etc on MQL4 Code Base but not the Double Weighted Moving Average which I think is very useful as well. Can someone shed some light on coding this Double Weighted Moving Average? In addition to that, I not so sure about the calculation phase but is the Linear Weighted Moving Average on MetaTrader is the same as the common Weight Moving Average that we can found on other platforms such as Ninja and TradeStation? Can someone confirm on this? Millions thanks in advance! Regards, I never heard about a double weighted moving average what is the formula for calculating a double weighted moving average ? Are you sure you are not talking about a double exponential moving average ? Also known as DEMA. 



Yes, just like DEMA. You average the EMA one more time. Double it. For TEMA, you average the DEMA one more time and make it 3 times in average. For Double Weighted Moving Average, take the standard Weighted Moving Average and average it one more time with the same period/length. Can you pls help? Many TIA! 

lwmaBuf[] dwmaBuf[] ... double LWMA(double array[], int per, int bar) { double Sum = 0; double Weight = 0; for(int i = 0;i < per;i++) { Weight+= (per  i); Sum += array[bar+i]*(per  i); } if(Weight>0) double lwma = Sum/Weight; else lwma = 0; return(lwma); } start(){... for(...){ lwmaBuf[shift] = LWMA(Close, MAperiod, shift); dwmaBuf[shift] = LWMA(lwmaBuf, MAperiod, shift); } 


Hi All:
We have DEMA, TEMA, AMA and etc on MQL4 Code Base but not the Double Weighted Moving Average which I think is very useful as well.
Can someone shed some light on coding this Double Weighted Moving Average?
In addition to that, I not so sure about the calculation phase but is the Linear Weighted Moving Average on MetaTrader is the same as the common Weight Moving Average that we can found on other platforms such as Ninja and TradeStation? Can someone confirm on this?
Millions thanks in advance!
Regards,
James