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

 
mario065:
Suggestions-how to fix it?
Explain in human language what you want from this script?
 
evillive:
Explain in human language, what do you want from this script?

Find the lowest/highest value of the Volume indicator from the beginning of the day until now.

If there is a new high/lowest value, it remembers the last one.

 

evillive,

Thank you for your attention :)

 
mario065:

Find the lowest/highest value of the Volume indicator from the beginning of the day to the present.

If there is a new high/lowest value it will remember the last one.

This is probably best:

//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
int high,low;
datetime timeh,timel;
//+------------------------------------------------------------------+
int init(){  
  return(0);
 }
int deinit(){
  Comment("");
  return(0);
 }  
//-------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnStart(){
    double   spred = MarketInfo(Symbol(),MODE_SPREAD);
    int      limit,Open_bar_per,Close_bar_per,av_vol;
    datetime Time_period,Close_per;
//+------------------------------------------------------------------+
       Time_period   = iTime(Symbol(),PERIOD_D1,0);
       Open_bar_per  = iBarShift(Symbol(),0,Time_period,false);
       Close_per     = iTime(Symbol(),0,0);
       Close_bar_per = iBarShift(Symbol(),0,Close_per,false);
       limit         = Open_bar_per - Close_bar_per;

int hivol_s=iHighest(NULL,0,MODE_VOLUME,limit,1);
int lovol_s=iLowest(NULL,0,MODE_VOLUME,limit,1);
high=iVolume(NULL,0,hivol_s);
low=iVolume(NULL,0,lovol_s);
timeh=iTime(NULL,0,hivol_s);
timel=iTime(NULL,0,lovol_s);
       av_vol = NormalizeDouble(high/3,0);
//+------------------------------------------------------------------+
     Print("\nВреме на брокера: ",TimeToStr(TimeCurrent(),TIME_SECONDS),", Локално време: "+TimeToStr(TimeLocal(),TIME_SECONDS),
             "\nТекущ спред: ",DoubleToStr(spred/10,1),
             "\n High_per  :  ",high,
             "\n Low_per   :  ",low,   
             "\n time_high :  ",TimeToStr(timeh,TIME_SECONDS),
             "\n time_low  :  ",TimeToStr(timel,TIME_SECONDS),
             "\n Close_per :  ",TimeToStr(Close_per,TIME_SECONDS),
             "\n Open_per  :  ",TimeToStr(Time_period,TIME_SECONDS), 
             "\n av_vol    :  ",av_vol
             ); 
  }

My comment does not show something, it prints fine...

 
void CalculateSimpleMA(int rates_total,int prev_calculated,const double &price[])
  {
   int i,limit;
//--- first calculation or number of bars was changed
   if(prev_calculated==0)
   
     {
      limit=InpMAPeriod;
      //--- calculate first visible value
      double firstValue=0;
      for(i=0; i<limit; i++)
         firstValue+=price[i];
      firstValue/=InpMAPeriod;
      ExtLineBuffer[limit-1]=firstValue;
      ExtLineBufferFid[1]=(firstValue*InpMAPeriod-price[i-InpMAPeriod])/i-1; Добрый человек предоставил вот такую реализацию(sma99[i]=(sma100[i]*100-d[i-100])/99;), но что то не выходит!

Greetings, apologies for the repetition, but interesting question!)

HOW to calculate:

Having a Sliding Period (e.g. 16) calculate a period of 15, starting from a period of 16.

 
evillive:

That's probably best:

My comment does not show something, print prints normally...

Hello evllive,

That's possible, but I don't need it. I need an array.

You can't see the comment because you use voidOnStart and I use intstart.

Here's what I wrote the other day in the comment file, written in Bulgarian.

I'll look into it today and see what we discussed.

Thanks for your feedback.

PS: I added another file.

File H_L- first indicator,file_6 in body explorer but only draws.

 
evillive:

It's probably better this way:

Comment I have something does not show, print outputs normally...

Said and done. I haven't put it in arrays yet, but I'll do it once I've converted it to an external function.

The lines are drawn on the first window of the indicator-data, if it is for volumetric, it needs a data brother for volumetric.

This way I formalize the range of the Volumet into parts low, medium, high.

 

Good evening!

Can you tell me what's wrong with my first EA? Didn't display the messages at the time of the fracture:

//--------------------------------------------------------------------

extern Period_MA=8; // Period of calculated MA

//--------------------------------------------------------------------

int start() // Special function start

{

double MA_f, // MA value on 0 bar

MA_s, // MA value on 1 bar

MA_t, // MA value on 2 bar

//--------------------------------------------------------------------

// Access to the function tech.ind.

MA_f =iMA(NULL,0,Period_MA,0,MODE_SMA,PRICE_CLOSE,0);

MA_s =iMA(NULL,0,Period_MA,0,MODE_SMA,PRICE_CLOSE,1);

MA_t =iMA(NULL,0,Period_MA,0,MODE_SMA,PRICE_CLOSE,2);

//--------------------------------------------------------------------

if (MA_t>MA_s<MA_f)

Alert("Fracture in the middle downwards");// Message

if (MA_t<MA_s>MA_f)

Alert("Break in the middle from above");// Message

//--------------------------------------------------------------------

return; //exit from start()

}

//--------------------------------------------------------------------

Thank you!

 
Top2n:

Greetings, apologies for the repetition, but interesting question!)

HOW to calculate:

Having a Sliding period (e.g. 16) calculate period 15, starting from period 16.

Y(n+1)=(Y(n)*n+x[n+1])/(n+1), where Y(i) is moving average of i values, x[i] is value number i. Numbering of values as in timeseries.

You'll be very obliged if you'll ever tell me why you need all this.

 
rapid_minus:

Good evening!

Can you tell me what's wrong with my first EA? Didn't display the messages at the time of the fracture:

...

Thanks!

if(MA_t>MA_s<MA_f)

Who breaks it like that? You have to bend the knee ;)

Do like this:

if(MA_t>MA_s && MA_s<MA_f)