MT4 indicator autoscroll

Back to topics list To post a new topic, please log in or register
avatar
14
adeller1 2015.01.05 09:25
 

Hello,

How do you make an indicator autoscroll? I use this indicator that calculates a moving average angle but I need to refresh it al the time. 

 What do I need to change/add so that it will automatically update on new tics/bars ?

Thanks

 

 

Attached files:
  maanglespecial.mq4  (4.61 KB)
avatar
13009
WHRoeder 2015.01.05 17:36 #
 
  1. You already have it. Your problem is else where. Probably exceeding array size.

  2. fEndMA=iMA(NULL,0,MAPeriod,0,MAMode,Price,i+EndMAShift);
    fStartMA=iMA(NULL,0,MAPeriod,0,MAMode,Price,i+StartMAShift);
    
    Your max look back is StartMaShift (you test End >= Start) so do your loop correctly.
    Your codeLook back handled
       nCountedBars = IndicatorCounted();       
    //---- check for possible errors            
       if(nCountedBars<0)                       
          return(-1);                           
    //---- last counted bar will be recounted
       if(nCountedBars>0) 
          nCountedBars--;
       nLimit = Bars-nCountedBars;
       ShiftDif = StartMAShift-EndMAShift;      
            mFactor = 100*840/Period()/ShiftDif;
       Sym = StringSubstr(Symbol(),3,3);        
                                                
                                                
    //---- main loop                            
       for(i=0; i<nLimit; i++)
    
    Decrement is unnecessary Contradictory information on IndicatorCounted() - MQL4 forum
       nCountedBars = IndicatorCounted();       
    //---- check for possible errors            
       if(nCountedBars<0)                       
          return(-1);                           
    //---- last counted bar will be recounted
    //   if(nCountedBars>0)                  
    //      nCountedBars--;                  
    //   nLimit = Bars-nCountedBars;         
       ShiftDif = StartMAShift-EndMAShift;      
            mFactor = 100*840/Period()/ShiftDif;
       Sym = StringSubstr(Symbol(),3,3);        
                                                
                                                
    //---- main loop                            
       for(i= Bars - 1 - MathMax(nCountedBars, StartMAShift); i>=0; i--)
    
    Get in the habit of counting down. (can't use future values to compute past ones.)
avatar
14
adeller1 2015.01.06 12:09 #
 

Thank you very much it works !

 

Back to topics list  

To add comments, please log in or register