my EMA is a constant

 
        /*Exp Moving Avg*/ 
                        EMA = iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,BarShift);
                        Print(EMA); 

When im checking at the Console the EMA vaule's its always constant\not changing\ always the same number .  (double EMA; as a global)

the bar shift came from this script :

// Execute on bar open
                if(CheckOncePerBar == true)
                        {
                                int BarShift = 1;
                                if(CurrentTimeStamp != Time[0]) 
                                        {
                                                CurrentTimeStamp = Time[0];
                                                bool NewBar = true;
                                        }
                                else NewBar = false;
                        }
                else 
                        {
                                NewBar = true;
                                BarShift = 0;
                        }

Thanks guys im appreciate it

 
vushel:

when im check at the Console the EMA is constant\not changing / always the same number .  

the bar shift came from this script :

Thanks guys im appreciate it

If you have CheckOncePerBar == true  the BarShift is 1 and then the EMA value will only change when you get a new bar,  what timeframe are you on ?
 
EMA = iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,BarShift);
Print("BarShift  ",BarShift,"  EMA =  ",EMA);

 Is BarShift 1   then EMA will change with new bar

Be patient if it is a monthly,weekly, daily or 4H Bar 

 
deVries:


 Is BarShift 1   then EMA will change with new bar

Be patient if it is a monthly,weekly, daily or 4H Bar 

 

 


the problem came the global Var.

i changed it to local var and the problem fixed ...

what do u mean in the second sentence ? the EMA fit himself to the current graph

 

thanks  

 
RaptorUK:
If you have CheckOncePerBar == true  the BarShift is 1 and then the EMA value will only change when you get a new bar,  what timeframe are you on ?


5 mins
 
vushel:

5 mins
So the EMA will not change for 5 minutes,  then it may change.