Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 217

 
Forexman77:

Trying to call Alert to check, nothing comes out. The thing is that my indicator has not changed for the last three bars. I set it up to cut off false movements.

For example, when I see growth it goes up, but if the next movements occur within the specified filter it does not change and moves strictly horizontally. Nebhodhimosti before the indicator flat, compare the last two values and determine the trend. If you want I can send you the code.

I have shown you how to find the nearest extremum of the indicator line in your Expert Advisor. Make nBars equal to Bars or just replace nBars with Bars
 
artmedia70:
I have shown you how to find the nearest extremum of an indicator line in an EA. Make nBars equal to Bars or just replace nBars with Bars

Many parameters now come out when any value is called:a,b or c.

The code of the indicator:

#property copyright ""
#property link      ""
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//--- input parameters

//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,2);
   SetIndexBuffer(0,ExtMapBuffer1);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    raznica,raznica_static,
    MA_1_t,                                                  
    MA_2_t;
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   static double MA_otshet;
   for(int i=0;i<limit;i++)
   {
      MA_1_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+0);  
      MA_2_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+1); 
      raznica=MA_1_t-MA_2_t;
      raznica_static=MA_1_t-MA_otshet;
      if(raznica_static > -0.001 && raznica_static < 0.001)
      {
      ExtMapBuffer1[i]=MA_otshet;
      }
      else
      if(raznica > -0.001 && raznica < 0.001)
      {
      ExtMapBuffer1[i]=MA_2_t;
      MA_otshet=MA_2_t;
      }
      if((raznica > 0.001) || (raznica <- 0.001))
      {
      ExtMapBuffer1[i]=MA_1_t;
      }
   }
   return(0);
  }
//+------------------------------------------------------------------+
 
Nah... You'd better show me what you're doing in your EA. How do you get the data from your indicator?
 
artmedia70:
Nah... You'd better show me what you're doing in your EA. How do you take the data from your inductor?

Nothing much, trying to Alert and see the nearest high there)

Load the indicator on the daily, three days with no change, that must be the problemA?

for (i=2; i<Bars; i++) {
double a=iCustom(NULL, 0, "EMAF",0,0,i+1);
double b=iCustom(NULL, 0, "EMAF",0,0,i);
double c=iCustom(NULL, 0, "EMAF",0,0,i-1);
if ((a-b)*(b-c)<0) {
if (b<c) {
;// Found bottom
}
if (b>c) {
Alert ("b=",b) // Found bottom
}
}
}

 
Forexman77:

Nothing much, trying to Alert and see the nearest high there)

Load the indicator on the daily, three days with no change, that must be the problemA?

for (i=2; i<Bars; i++) {
double a=iCustom(NULL, 0, "EMAF",0,0,i+1);
double b=iCustom(NULL, 0, "EMAF",0,0,i);
double c=iCustom(NULL, 0, "EMAF",0,0,i-1);
if ((a-b)*(b-c)<0) {
if (b<c) {
;//Find the bottom
}
if (b>c) {
Alert ("b=",b)// Found peg
}
}
}

That can't be the problem. We did the loop before Bars. Write break after the alert;
 
artmedia70:
That can't be the problem. We have done the loop before Bars. After the alert, write break;

.
After break; one message appears. But the value doesn't correspond to the indicator, maybe there is something wrong with the indicator itself?
The indicator shows the line as I need it. The calculation of the indicator is based on three conditions, which correspond to the current situation.
 
Forexman77:
After break; one message appears. But, the value doesn't match the indicator, maybe there's something wrong with the indicator itself?
The indicator shows the line as I need it. The indicator is calculated based on three conditions that correspond to the current situation.

Instead of Alert("b=",b); Type:

Alert("Цена b="+DoubleToStr(b,Digits)+"\nВремя бара="+TimeToStr(Time[i]));
 
artmedia70:

Instead of Alert("b=",b); Write:



I can't, I've tried it in different ways. The values are clearly not appropriate,

Yes and time in all values "Bar time=2010.11.04 00:00". Calling through the script.

Most likely the problem is with the indicator: the value is obtained from

ExtMapBuffer1[i]

which is obtained from three different conditions corresponding to the current time.

When I call the current EURUSD value everything is OK: 1.3717, what cannot be said about the highs.

 
Folks, could you please tell me the code that showed the balance that was at the beginning of the month...
 
Zolotai:
Folks, could you please tell me the code, the code that showed the balance that was at the beginning of the month...

yes there is a piece of paper with a pen =))
Reason: