Would someone be kind enough to check this expression for me?

 
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
 

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).
 
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.
 
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