Download MetaTrader 5

spooky spots

To add comments, please log in or register
Carl Schreiber
7111
Carl Schreiber  

I have made a simple indicator (attached) that detects a simple ma change.

It calcs down to i>0 (min==1) sets the buffer i-1 (min==0!!) the open[i-1] which would be a possible enter-price.

This simple indicator creates after some hours of running spooky spots in the night sky??

Is this there a mistake in my indicator?

To create the spooky spots youself the indicator has to run quite a bunch of hours - this one started yesterday after the market opened - its now ~12h on m1 chart.

And it could be that you have to switch off Autoscroll!


Files:
ffoorr
1081
ffoorr  

This is because jour index "i" is not right. When the chart is refreshed, the indicator is drawed again, but not at the right place;

Should be something like that,( i did not test it) :

int start() {
//==========================================================  
   int i=-1, counted_bars = IndicatorCounted();     
   if(counted_bars < 0 ) return(0);
   if(Bars < 500 )       return(0); 
   if(counted_bars <Ma_Period )  i= Bars - Ma_Period;
   if(counted_bars >=Ma_Period ) i= Bars - counted_bars -1;   
//------------------------------------------------------- 11 --
   while( i >= 0 ) { 
            ma[i] = iMA(NULL,0,Ma_Period,0,0,Price1,i);
                   
                      trend[i] = trend[i+1];    
        if( ma[i] > ma[i+1]+Ma_MinChgPoint*Point )  trend[i] = +1;
        if( ma[i] < ma[i+1]-Ma_MinChgPoint*Point )  trend[i] = -1;
                        
       if( trend[i] == 1 ) { line_up[i] = ma[i]; line_down[i]= 0.0; }
          //idem line down 
         
       if( trend[i+1] == -1 && trend[i] == +1 ) arrow_up[i] = Close[i];
       else                                     arrow_up[i] = 0.0;   
          //idem arrow down 
        i--;
        }
    //------- 
   return(0);
}
Carl Schreiber
7111
Carl Schreiber  
ffoorr:

This is because jour index "i" is not right. When the chart is refreshed, the indicator is drawed again, but not at the right place;

Wouldn't that mean that all the bar dependent values like Close[i] would have wrong prices?
ffoorr
1081
ffoorr  
gooly:
Wouldn't that mean that all the bar dependent values like Close[i] would have wrong prices?

   "i" is not right, so close[i] is maybe Close(10] or Close[100]. when the chart is refreshed.  

  we cannot kown if all the bar are wrong, depend's of the coding of the index "i", which is not easy to understand.

ffoorr
1081
ffoorr  

gooly

the index "i" is good, ( i have a look at the ternary operator)

  something get lost when the chart refresh, maybe some static or something in the code when the

counted_bar come back to zero

To add comments, please log in or register