#define WMA_PERIOD 4 double sma=0; int count=0; for(int shift=1; shift < 4 shift++){ sma += iMA(NULL,0, WMA_PERIOD, 0, MODE_WMA, PRICE_CLOSE, shift); count++; } sma /= count;
I think that should be MODE_LWMA
Not if you know how to compute SMA.
Dear WHRoeder,
Thank you very much for fast reply but I still do not know how to implement your suggestions. I would be very gratefull if you colud put the whole code for such trading condition:
Buy if: SMA(external variable_a) of WMA(eternal variable_b) for current bar > SMA(external variable_a) of WMA(eternal variable_b) for (-1) bar AND
SMA(external variable_a) of WMA(eternal variable_b) for (-1) bar > SMA(external variable_a) of WMA(eternal variable_b) for (-2) bar
Close if: SMA(external variable_a) of WMA(eternal variable_b) for current bar < SMA(external variable_a) of WMA(eternal variable_b) for (-1) bar AND
SMA(external variable_a) of WMA(eternal variable_b) for (-1) bar < SMA(external variable_a) of WMA(eternal variable_b) for (-2) bar
Thank you very much in advance
Qhciu
No slaves here, Learn to Code or Pay someone.
Hi,
You gave me a "kick" to get down to work and I finally managed to finish it on my own and it works !!! I have one more question. What function should I use if I want to trade on open price of the current bar based on the signal coming from my indicator calculated on the just closed bar?
Thanks
Qhciu
What function should I use if I want to trade on open price of the current bar based on the signal coming from my indicator calculated on the just closed bar?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear All,
I am quite fresh to programming and I would appreciate your help. In my EA I use a condition based on smoothed WMA. Could you please help me to write a function that calculates 3 days SMA of 4 days WMA for 1 bar ago, 2 bar ago and 3 bar ago for closing price? Do I need array function for it?
Thank you very much.
Greetings
Qhciu