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

 
pycha:
I thought it would be nice to relieve them and make them redraw only the window that is currently active and visible. the rest will not redraw until a user switches to them

I don't need API for this, everything is not simple, but very simple.

 
tara:

You don't need an API to do this, it's not simple, it's very simple.

so please give a solution to a beginner
 
For the beginner-not-beginner, I can advise you to save in the same GV the name of the currency pair at the moment you start the Expert Advisor.
 
they all run simultaneously when the client starts. either i missed you again, or
saving in the same GV the name of the currency pair at the moment of launching the Expert Advisor.
will not be of any use
 
pycha:
they all start at the same time when the client starts. either i misunderstand you again, or it won't do any good

You just don't seem to like cats.

You just don't know how to cook them.

The EA will trigger a redraw if and only if the active chart symbol is the same as its start symbol.

 
I get it, half of the problem is solved)))). but there and in the Expert Advisor performs functions to prepare for redrawing, array clearing, entering new data into arrays - what can and should not be done. now the Expert Advisor runs on 20 tools and the CPU is constantly loaded by 5 - 10%. looking for any ways to facilitate and optimize )))))
 
Not to me.
 
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//--- check for bars count
   if(rates_total<InpMAPeriod-1 || InpMAPeriod<2)
      return(0);
//--- counting from 0 to rates_total
   ArraySetAsSeries(ExtLineBuffer,false);
 //  ArraySetAsSeries(ExtLineBufferFid,false);
   ArraySetAsSeries(close,false);
//--- first calculation or number of bars was changed
   if(prev_calculated==0)
   {
      ArrayInitialize(ExtLineBuffer,0);
      ArrayInitialize(ExtLineBufferFid,0);  
   }       
//--- calculation
  
    CalculateSimpleMA(rates_total,prev_calculated,close);
    
    ExtLineBufferFid[rates_total-3]=(ExtLineBuffer[rates_total-2]*InpMAPeriod+close[InpMAPeriod+1])/(InpMAPeriod+1);
  //sma99[i]=(sma100[i]*100-d[i-100])/99;
//(firstValue*InpMAPeriod+price[i+1])/InpMAPeriod;
///(firstValue*InpMAPeriod+price[InpMAPeriod+1])/(InpMAPeriod+1);
// Y[i]=Y[i+1]+(X[0]-X[N])/N    
    Print("  ",ExtLineBufferFid[rates_total-3]
         ,"  ",ExtLineBufferFid[rates_total-2]
         ,"  ",ExtLineBuffer[rates_total-2]
             );      
//--- return value of prev_calculated for next call
   return(rates_total);
  }

I'm sorry, it's a shame to go over the same thing a hundred times.

I've been staring like a sheep at the gate for almost a month now. I don't understand anything.

The task is to calculate a lesser moving average with a moving average of 13,

that is, to calculate a period of 12 based on 13.

 
Top2n:

I'm sorry, it's a shame to go over the same thing a hundred times.

I've been staring like a sheep at the gate for almost a month now. I don't understand anything.

The task is to calculate a lesser moving average with a moving average of 13,

that is, to calculate a period of 12 based on 13.

What's the point of calculating not directly on the same period you want?!
 
Top2n:

I'm sorry, it's a shame to go over the same thing a hundred times.

I've been staring like a sheep at the gate for almost a month now. I don't understand anything.

The task is to calculate a lesser moving average with a moving average of 13,

that is, to calculate a period of 12 based on 13.

Easy to calculate: Y(N)=1/N*(Y(N+1)*(N+1)-X[N]), where Y(i) - value of MA(i) on zero bar, X[j] - price value on j-th bar; only this is computational nonsense, while it doesn't allow to look into future anyway.