Useful features from KimIV - page 97

 

the terminal has an option to set the equidistant channel, you can set it instead of drawing the trend lines

here is a function similar to the trend line setting

// установка равноудалённого канала
void SetСhannel(string nm,datetime t1,double p1,datetime t2,double p2,datetime t3,double p3,color cl=Red,int st=0,int wd=1,bool ry= False){
// Параметры:
// nm - наименование               (  ""  - текущее время)
// t1,t2,t3 - время открытия бара  (  0   - Time[10]
// p1,p2,p3 - ценовой уровень      (  0   - Low[10])
// cl - цвет линий
// st - стиль линий                (  0   - простая линия)
// wd - ширина линий               (  1   - по умолчанию)
// ry - луч                        (False - по умолчанию)

  if( nm=="") nm=TimeToStr(TimeCurrent(), TIME_DATE| TIME_SECONDS);
  if(ObjectFind( nm)<0){
   ObjectCreate( nm,OBJ_CHANNEL,0, t1, p1, t2, p2, t3, p3);
   ObjectSet( nm, OBJPROP_COLOR, cl);
   ObjectSet( nm, OBJPROP_STYLE, st);
   ObjectSet( nm, OBJPROP_WIDTH, wd);
   ObjectSet( nm, OBJPROP_RAY, ry);
  }
  ObjectSet( nm, OBJPROP_TIME1, t1);
  ObjectSet( nm, OBJPROP_PRICE1, p1);
  ObjectSet( nm, OBJPROP_TIME2, t2);
  ObjectSet( nm, OBJPROP_PRICE2, p2);
  ObjectSet( nm, OBJPROP_TIME3, t3);
  ObjectSet( nm, OBJPROP_PRICE3, p3);
}
 
Roger писал(а) >>

It seems to be on the right.

oops...

 
DECIDE >>:

в терминале есть возможность установки равноудалённого канала, можно вместо отрисовки трендовых линий устанавливать его

вот составил функцию по подобию установки трендовой линии

interesting

how to set the distance between the lines ?

 

the distance is set by itself, you only need to indicate three points t1,p1,t2,p2,t3,p3

I gave up this function (it has one short line), it is easier, more instructive to draw trend lines

 
DECIDE >>:

растояние само устанавливается, надо только указать три точьки t1, p1, t2, p2, t3, p3

отказался я от этой функции(там одна линия короткая), проще, нагляднее просто трендовые линии рисовать

set the distance between the lines

the second line is supposed to be shifted relative to the first (trend) line and parallel to it horizontally by a certain value of bars - for example, by 5 bars

this is also an equidistant channel which cuts spikes up or down depending on the baseline setting and the trend direction.

 

The function removes zeros from the duplicate array and returns the index of the minimum of the array

int ArrMin(double & x[]){
  while( x[ArrayMinimum( x)]==0){
    for(int i=ArrayMinimum( x); i<ArraySize( x)-1; i++){
      x[ i]= x[ i+1];
    }
    ArrayResize( x,ArraySize( x)-1);
  }
  return(ArrayMinimum( x));
}
 

Good afternoon everyone!

I don't know if this issue has already been discussed... But I wanted to suggest to make a function for EAs to work with a fixed balance.

This is necessary for optimizing EAs.

What we have here is as follows: when we start the EA, it starts to earn and AccountBalance starts to increase and the EA uses an ever increasing amount of balance.

If we introduce a variable, such as Valance, and set an amount in it, which the EA will "see" and purchase only for this amount. This will allow us to think that every time the EA starts to work, it will think that it only has Balance money at its disposal and over the entire testing period we will be able to believe how the EA would work if we switch it on any given day, excluding the factor of the real balance change.

Optimized with this variable, the Expert Advisor will work more normally in the future.

The only thing left to do is to code such a function.

This is all I know:

extern double Balance = 10000;

int init() {

//fix the balance at the beginning of the EA operation

Balance=AccountBalance;

return (0);

}

int start {

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

???

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

}

And what to write in ??? I do not know. If there was a function in the EA where the calculation of the possible number of opening orders with a given lot was performed, using AccountBalance, you could simply replace AccountBalance() with a variable, but not all EAs explicitly do this.

 

Не знаю, может этот вопрос уже обсуждался... Но я хотел предложить сделать функцию для работы советника с фиксированным балансом.

I solved this problem this way

I have a lot of different Expert Advisors and when I start any of them, for the first time a day, the account balance is stored in a global variable and based on this the Expert Advisors calculate the number of lots and the resulting income, showing the information on the chart in the comments (yield: so-and-so %)

 
DECIDE писал(а) >>

I have a lot of different EAs and when I start any of them, the first time a day, the account balance is saved in a global variable and based on that the EAs calculate the number of lots and the resulting income, showing information on the chart in the comments (yield: so-and-so %)

Can you share with us the details how it can be done?

 

нужна мне такая возможность - параллельного горизонтального смещения (копирования, переноса...) трендовой линии на определенное кол-во баров

Geronimo, describe the algorithm in more detail in my personal or ICQ: 9773190, let's not clutter up the thread

Any way I can help

share the details how to do it?

Nail_Saby, I described the gist, and you can implement it in different ways, depends on how and what exactly you need