This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
Would someone be kind enough to check this expression for me?Back to topics list |
|
Kcoyne
2005.08.16 07:13
LMA=iMA(NULL,0,LMP,1,MODE_EMA,PRICE_CLOSE,0);
Where: LMA is the long moving average LMP is the long moving period , 1, is one period back Price_close is ema calculated on the close of the period, 0, is current period This is what I want to happen but I am getting multiple crosses when there should only be one cross if it has happened in the past. Any help would be appreciated Kevin |
|
Quark
2005.08.16 12:14
LMA=iMA(NULL,0,LMP,1,MODE_EMA,PRICE_CLOSE,0); Assuming you use MT4, in the Help: double iCustom( string symbol, int timeframe, string name, ... , int mode, int shift) Therefore, at least, you are missing the indicator name (3rd parameter). |
|
GT48aec42c270a6
2005.08.16 12:42
I don't understand where iCustom comes into this, perhaps I'm misunderstanding.
But the reason you might be getting multiple crosses where there should be one is that when you measure bar '0' you are measuring the current bar which is still forming. This means that the value of the MA changes as the price changes. As price hovers in a small range right the cross level, it is going to go back and forth repeatedly thereby triggering one cross then another and so on. This might be the answer you're looking for. |
|
hardwood
2005.08.16 13:57
K coyne,
The 1 after LMP means that you are shifting the whole MA line relative to the bar chart. You probably dont want this and the default value is 0. Then as GT suggested, use 1 as the last parameter for the most recently closed bar. Best regards, Hugh |
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
