[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 518

 
Pacman:

Hi all!

Please help me write this indicator.

I want it to show min and max for the last n number of bars.

I've started to write the code, but I can't figure out how to write the logic correctly.


MQL4 Tutorial-->Variables--> Arrays--> Task 26.:Find the minimum and maximum price values of the last n bars. (extremumprice.mq4)
 
Roll:

MQL4 Tutorial-->Variables-->Assets-->Task 26.:Find maximal and minimal price value of the last n bars (extremumprice.mq4)


Thank you very much for the link)

I read the textbook but forgot about this example.

Thank you again!

 
Good evening. Please help me solve this problem: there are two curves, one with coordinates ay1, ay2 ... ayN, the other with coordinates by1, by2 ... byN. It is required to find out whether there is such a value of K, at which the condition SUM((ayN-K*byN)^2)/N <=C, where C is some number.
 
Hello Dear forum users, I'm a newbie, I'm writing my first Expert Advisor, can you help me fix an algorithmic bug, (closing orders by criterion doesn't work((?)), here is a file ...
 

Good evening everyone.

I tried to write an indicator (it's my first indicator) that should display minimum and maximum price value among the last n bars.

I can't seem to understand what i've got wrong.

Please help me to understand what i am trying to do!

The countdown starts from 1 bar.

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Red

extern int Quant_Bars = 5; //количество баров
int i;                     //номер бара
int Minimum;               //минимум за n баров
int Maximum;               //максимум за n баров

//--- buffers
double Line_1[];     //объявление массивов под..
double Line_2[];     //..буферы индикаторов

int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);    //стиль линии
   SetIndexBuffer(0,Line_1);                    //назнач. массива буферу
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);    //стиль линии
   SetIndexBuffer(1,Line_2);                    //назнач. массива буферу
//----
   return;                                      
  }

int start()
  {                        
   double Minimum = Bid;      //мин. цена
   double Maximum = Bid;      //макс. цена
   
   for(i=1; i<=Quant_Bars; i++)
   {
    if(Low[i]<Minimum)        //если меньше известного..
       Minimum = Low[i];      //..то оно и будет минимальным
      
    if(High[i]>Maximum)       //если большн известного..
       Maximum = High[i];     //..то оно и будет максимальным
    }
       
    Line_1[i] = Minimum;      //отобразить линию минимума
    Line_2[i] = Maximum;      //отобразить линию максимума
   
   return;
  }
 
AndEv:
Good evening. Please help me solve this problem: there are two curves, one with coordinates ay1, ay2 ... ayN, the other with coordinates by1, by2 ... byN. It is required to find out whether there is such a value of K, at which the condition SUM((ayN-K*byN)^2)/N <=C, where C is some number.
Rather, they are not curves, but broken lines. Ask Alexey.
 

Good evening.

I'm a bit of a "crucian" when it comes to coding :) I am building an Expert Advisor based on Fibonacci indicator. I am not paying attention to the strategy so far. The problem is 7 Fibonacci levels, how to make each level crossed set only 2 different pending orders and no more.

I would appreciate any tips.

Sorry for my awkward russian.

Files:
 
valenok2003:


Use multiple of periods.

e.g. for H1

extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;

if you want the same values for H3

set it on H1

extern int FastEMA=36;
extern int SlowEMA=78;
extern int SignalSMA=27;

does not work for all indices,

Appendix: Example of a stochastic implementation for an arbitrary TF

Your code suggests that you can write any number of minutes in the second parameter of any indicator. For example iRSI(NULL, 300, .....) - for H5 timeframe. Is it true?
 
Pacman:

Good evening everyone.

I tried to write an indicator (it's my first indicator) which should display minimum and maximum price value among the last n bars.

I can't figure out where I'm going wrong.

Please help me to understand what i want to do!

The countdown starts from 1 bar.


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Red

extern int Quant_Bars = 5; //количество баров
int i;                     //номер бара
int Minimum;               //минимум за n баров
int Maximum;               //максимум за n баров

//--- buffers
double Line_1[];     //объявление массивов под..
double Line_2[];     //..буферы индикаторов

int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);    //стиль линии
   SetIndexBuffer(0,Line_1);                    //назнач. массива буферу
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);    //стиль линии
   SetIndexBuffer(1,Line_2);                    //назнач. массива буферу
//----
   return;                                      
  }

int start()
  {                        
   double Minimum = Bid;      //мин. цена
   double Maximum = Bid;      //макс. цена
   
   for(i=1; i<=Quant_Bars; i++)
   {
    if(Low[i]<Minimum)        //если меньше известного..
       Minimum = Low[i];      //..то оно и будет минимальным
      
    if(High[i]>Maximum)       //если большн известного..
       Maximum = High[i];     //..то оно и будет максимальным
    }

   //
   // Здесь как минимум нужен цикл, лучше два разных - для мин и макс ..............
   //
    Line_1[i] = Minimum;      //отобразить линию минимума
    Line_2[i] = Maximum;      //отобразить линию максимума
   
   return;
  }
 

Good evening! Tell me, would it be enough to put one or two arrows?

bool napravlenieCCI=false;
 if( CCI_50S<100&&CCI_50>100 ||CCI_50S<0&&CCI_50>0|| CCI_50S<-100&&CCI_50>-100  )napravlenieCCI=true;// if( CCI_50S>CCI_50&& )napravlenieCCI=false;
  if(napravlenieCCI){  ObjectCreate( "name", OBJ_ARROW, 0, TimeCurrent(),Ask);}