Algorithmic ''centrifuge'' - page 13

 
Aleksei Stepanenko:

OK, ...

- maybe something else...

We need to use the GA to find IT (ideal points) in some way. I'm thinking about it.
 
Igor Makanu:

Ideal entry points on the history - ZigZag, you have rejected

I don't want to use ZigZag because it profanates the idea. If ZZ is a perfect perfect point indicator, then it is the most IDEAL indicator of all, because it hits the perfect points more accurately than any other. It turns out - ZigZag should be in every Trade Signal build in EVERY strategy. And this is nonsense.

I believe that the areas of trades on the history should be determined by the criteria: time/profit/risk and use GA.

 
Реter Konow:

I don't want to use ZigZag because it profanates the idea. If ZZ is a perfect perfect point indicator, then it is the most IDEAL indicator of all, because it hits the perfect points more accurately than others. It turns out - ZigZag should be in every Trade Signal build in EVERY strategy. And this is nonsense.

I believe that the areas of trades on history should be determined by the criteria: time/profit/risk and use GA.

i have nothing against

I don't see what to discuss, I'm off for now.

 
Реter Konow:
We need to somehow involve the GA in the search for IT (ideal points). I am thinking about it.

I don't get it. Perfect points are already known on history. They are extrema, and you can see them with your eyes. It does not require complex algorithms to find extrema. We only need to identify the conditions for identifying them (for instance, exceeding a certain number of points between two opposite adjacent extrema). Then we can create an array of those extrema (price, date) and check the value of any indicator at the point of each extremum (or at its approach) using the same history. Right?

Here is a "make-it-or-break-it" code for searching and storing extrema of history (without performance guarantee):

input double Distance=100;

//каждый элемент массива будет содержать три поля: дата, цена и положение экстремума (верх, низ) 
struct sextr{datetime time; double price; int position;} Extremes[];

void OnStart()
   {
   int Total=iBars(Symbol(),0);
   for(int i=Total-1; i>=0; i--)
      {
      WriteExtremum(Extremes,Distance,Symbol(),0,i);
      }
   }   

//здесь записываем экстремумы в массив
void WriteExtremum(sextr &eExtremes[], double eDistance, string eSymbol, int eTimeFrame, int eShift)
   {
   int eFinish=ArraySize(eExtremes)-1;
   double eHigh=iHigh(eSymbol,eTimeFrame,eShift);
   double eLow=iLow(eSymbol,eTimeFrame,eShift);
   datetime eTime=iTime(eSymbol,eTimeFrame,eShift);
   //если массив пустой
   if(eFinish<0)
      {
      ArrayResize(eExtremes,++eFinish+1);
      eExtremes[eFinish].time=eTime;
      //пока мы не знаем какой из экстремумов будет в первом элементе, поэтому берём цену по середине
      //можно сделать более грамотнее, но лень. Поэтому первый экстремум у нас будет бракованный 
      //и мы его потом затрём 
      eExtremes[eFinish].price=(eHigh+eLow)/2;
      eExtremes[eFinish].position=0;
      }
   //если в массиве есть элементы
   else
      {
      //текущий элемент - максимум
      if(eExtremes[eFinish].position==1)
         {
         //произошло обновление текущего экстремума
         if(eHigh-eExtremes[eFinish].price>0)
            {
            eExtremes[eFinish].time=eTime;
            eExtremes[eFinish].price=eHigh;
            }         
         //произошло превышение расстояния между противоположными экстремумами
         if(eExtremes[eFinish].price-eLow>eDistance)
            {
            ArrayResize(eExtremes,++eFinish+1);
            eExtremes[eFinish].time=eTime;
            eExtremes[eFinish].price=eLow;
            eExtremes[eFinish].position=-1;
            }
         }
      //текущий элемент - минимум
      if(eExtremes[eFinish].position==-1)
         {
         //произошло обновление текущего экстремума
         if(eExtremes[eFinish].price-eLow>0)
            {
            eExtremes[eFinish].time=eTime;
            eExtremes[eFinish].price=eLow;
            }         
         //произошло превышение расстояния между противоположными экстремумами
         if(eHigh-eExtremes[eFinish].price>eDistance)
            {
            ArrayResize(eExtremes,++eFinish+1);
            eExtremes[eFinish].time=eTime;
            eExtremes[eFinish].price=eHigh;
            eExtremes[eFinish].position=1;
            }
         }
      //эта ситуация, когда первый элемент не закрылся, и не понятно максимум это будет или минимум
      //если произошло превышение в любую сторону, тогда затираем значения первого элемента
      if(extremes[eFinish].position==0)
         {
         //произошло превышение расстояния между противоположными экстремумами
         if(eHigh-eExtremes[eFinish].price>eDistance)
            {
            eExtremes[eFinish].time=eTime;
            eExtremes[eFinish].price=eHigh;
            eExtremes[eFinish].position=1;
            }            
         if(eExtremes[eFinish].price-eLow>eDistance)
            {
            eExtremes[eFinish].time=eTime;
            eExtremes[eFinish].price=eLow;
            eExtremes[eFinish].position=-1;
            }
         }
      }   
   }

Additionally, this code should capture and process studs - that is, when one candle overlaps both the maximum and the minimum at the same time, as well as the minimum time between extrema.

Now that the array with extrema is filled, you know where and when to look at your indicators. But doubts about their usefulness remain:)

 
Реter Konow:

I don't want to use ZigZag because it profanates the idea. If ZZ is a perfect perfect point indicator, then it is the most IDEAL indicator of all, because it hits the perfect points more accurately than any other. It turns out - ZigZag should be in every Trade Signal build in EVERY strategy. And this is nonsense.

I believe that the areas of trades on the history should be determined by the criteria: time/profit/risk and use GA.

You don't understand the BIT of the Zig-Zag indicator...

The ZZ indicator is indeed an IDEAL indicator, but only as a setting for other indicators...

 
Serqey Nikitin:

You don't understand the point of the Zig-Zag indicator...

The ZZ indicator is indeed an IDEAL indicator, but only as a setup for other indicators...

The problem with ZZ is that it does not take into account the time/profit/risk ratio of trades.
ZZ entry points will produce disproportionate trades. They will not take into account trend/float. The corridors will be placed inside the sections of trades, along with the peaks.
ZZ accommodates all dynamics, and it seems senseless to pick other indicators using it. At least not smart.

We need another approach. Not only ideal entry/exit points, but also observance of internal proportions of deals - the time of position duration, its profit and risk.

By risk, in this context, I mean not the ratio of the lot, stop and deposit, but the stability of price change in an open position. The less stable the change (hammering), the greater the risk of losing profit.

Therefore, the ideal entry/exit points should not be sought according to the principle "the higher the profit, the better", but according to the principle "the ideal deal is the deal with the best ratio of time, profit and risk".

This is my opinion.
 
Aleksei Stepanenko:

I don't get it. The ideal points are already known on history. These are extrema and can be seen with the eyes. It does not require complex algorithms to find extrema. We only need to identify the conditions for identifying them (for example, exceeding a certain number of points between two opposite adjacent extrema). Then we can create an array of those extrema (price, date) and check the value of any indicator at the point of each extremum (or at its approach) using the same history. Right?

Here is a cranked code for searching and storing history extrema (without performance guarantee) as an example:

Additionally, this code should catch and process spikes - when one candlestick covers both maximum and minimum at the same time, as well as the minimum time between extrema.

Now that the array with extrema is filled in, you know where and when to look at your indicators. But doubts remain about their usefulness:)

Thanks for the code. Not sure how easy it is to find IT, though.
 

Peter, can you draw an example of a few hand-drawn trades on a chart? Entry and exit. Preferably take a piece of the chart with a variety of price movements. And explain why at these points. What is the time/profit/risk ratio of deals?

Because I don't quite understand your idea of an ideal point.

 
Aleksei Stepanenko:

Peter, can you draw an example of a few hand-drawn trades on a chart? Entry and exit. Preferably take a piece of the chart with a variety of price movements. And explain why at these points. What is the time/profit/risk ratio of deals?

Because I don't quite understand your idea of an ideal point.

Yes, I will do that later. I haven't quite figured it out myself yet. I might change my point of view. So, if anything, sorry. ))
 

No problem.

The fact that you're taking it out on Zig-Zag, it makes sense. Zig-Zag doesn't know anything about the trend. He's just ticking away like clockwork both trending and flat. His waves(knees) are not trend waves. Trend waves are built according to the following rule: a trend is considered ongoing if it conquers new peaks. This means that the next trend wave always overshoots the previous one, and if it does not, then it is not a wave.