An indicator based on the addition of likely prices. - page 5

 
The code will be issued shortly. With some conditions. I still have to smooth it out so I don't burn with embarrassment...
 
Koprezer:
Code will soon give out. With some conditions. I still need to smooth it over so as not to burn with shame...

code is optional, although desirable. There are no "code required" rules, it's not his style you want to discuss ?

It's just that in order to discuss, you need a discussion topic. Formulas, inferences, calculations, justifications. Just pictures don't interest anyone, believe me.

...then you might get some "associates" to help you move things along. Although there will certainly be more trolls :-)

And the code, the code will be written in several variants anyway.

 
//+------------------------------------------------------------------+
//|                                                  Povodok_001.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
#property indicator_buffers 3
#property indicator_plots   3
//--- indicator buffers
#define  ctr    1                    // максимальная дельта между опорными ценами

double Lad [ctr+2,3];              // Массив возможных рассчитанных цен
double PraiseB,PraiseA,PraiseS;     // Средняя верхняя, средняя нижняя и просто средняя цены
uint nB,nA,nS;                      // делители
int NaxNole;                        // опорный бар

double         LABuffer[], LBBuffer[], LSBuffer[]; // Бувера для визуализации индикатора

int OnInit()
  {

   SetIndexBuffer(0,LABuffer,INDICATOR_DATA); //--- задать рисование линии
   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE); //--- задание стиля для рисования линии
   PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID); //--- задание цвета линии
   PlotIndexSetInteger(0,PLOT_LINE_COLOR,clrRed); //--- задание толщины линии
   PlotIndexSetInteger(0,PLOT_LINE_WIDTH,1); //--- задание метки для линии
   PlotIndexSetString(0,PLOT_LABEL,"Верхняя граница"); //--- привязка массива к индикаторному буферу с индексом 1

   SetIndexBuffer(1,LSBuffer,INDICATOR_DATA); //--- задать рисование линии
   PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE); //--- задание стиля для рисования линии
   PlotIndexSetInteger(1,PLOT_LINE_STYLE,STYLE_SOLID); //--- задание цвета линии
   PlotIndexSetInteger(1,PLOT_LINE_COLOR,clrGold); //--- задание толщины линии
   PlotIndexSetInteger(1,PLOT_LINE_WIDTH,1); //--- задание метки для линии
   PlotIndexSetString(1,PLOT_LABEL,"Расчетное возможное");

   SetIndexBuffer(2,LBBuffer,INDICATOR_DATA); //--- задать рисование линии
   PlotIndexSetInteger(2,PLOT_DRAW_TYPE,DRAW_LINE); //--- задание стиля для рисования линии
   PlotIndexSetInteger(2,PLOT_LINE_STYLE,STYLE_SOLID); //--- задание цвета линии
   PlotIndexSetInteger(2,PLOT_LINE_COLOR,clrBlueViolet); //--- задание толщины линии
   PlotIndexSetInteger(2,PLOT_LINE_WIDTH,1); //--- задание метки для линии
   PlotIndexSetString(2,PLOT_LABEL,"Нижняя граница");
//---
   ENUM_ACCOUNT_TRADE_MODE tradeMode=(ENUM_ACCOUNT_TRADE_MODE)AccountInfoInteger(ACCOUNT_TRADE_MODE);
   switch(tradeMode)
     {
      case(ACCOUNT_TRADE_MODE_DEMO):
         break;
      case(ACCOUNT_TRADE_MODE_CONTEST):
         Print("Внимание! Вы используете тестовую версию Индикатора! Возможны сбои и зависания.");
         break;
      default:
        {
         Print("Использование данного индикатора для реальных сделок не желательно!");
         Print(" Вы используете тестовую версию Индикатора. Оно! Вам! Нужно! Так рисковать?");
         Print(" https://www.mql5.com/ru/users/koprezer E-mail:mts_signal@mail.ru");
        };
     }
//---
   return(INIT_SUCCEEDED);
  }

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[])
//---
  {
   int start;
   int prb;
   if(prev_calculated==0)
      start=ctr*ctr; // установим начальный индекс для входных массивов
   else
      start=prev_calculated;    // установим start равным последнему индексу в массивах
   for(int d=0; d<start; d++) // Тех работа получить 100 значений индикатора d- шагов в историю
     {
        {
         //---
         for(int v=0; v<ctr; v++)
           {
            for(int i=0; i<3; i++)
              {
               Lad [v,i]=0;// подготовка к расчету
              }
           }
         NaxNole=rates_total-d-1; // текущие положение
         PraiseS=0;
         nS=0;
         for(int i=1; i<ctr+1; i++)  // строка дельта
           {
            prb=NaxNole-i*2+1;
            if(prb>rates_total)
               prb=rates_total;
            if(prb-i<0)
               prb=i;
            Lad [i,0]=open[prb]-open[prb-i]+open[prb];//  расчет
            Lad [i,1]=high[prb]-high[prb-i]+high[prb];//  расчет
            Lad [i,2]=low[prb]-low[prb-i]+low[prb];//  расчет
            PraiseS+=Lad [i,0];
            nS++;
            PraiseS+=Lad [i,1];
            nS++;
            PraiseS+=Lad [i,2];
            nS++;
           }
         PraiseS/=nS;
         nA=0;
         PraiseA=0;
         nB=0;
         PraiseB=0;
         for(int i=1; i<ctr+1; i++)
           {
            for(int k=0; k<3; k++)  // строка
              {
               if(Lad[i,k]>PraiseS)
                 {
                  nA++;
                  PraiseA+=Lad[i,k];
                 }
               if(Lad[i,k]<PraiseS)
                 {
                  nB++;
                  PraiseB+=Lad[i,k];
                 }
              }
           }
         LSBuffer[rates_total-d-1]=PraiseS;
         if(nA==0)
            PraiseA=PraiseS;
         if(nA !=0)
            PraiseA/=nA;
         if(nB==0)
            PraiseB=PraiseS;
         if(nB !=0)
            PraiseB/=nB;
         LABuffer[rates_total-d-1]=PraiseA;
         LBBuffer[rates_total-d-1]=PraiseB;
        }
     }
   return(rates_total);
  }

//+------------------------------------------------------------------+


It is customary here to insert code via a form.

 

Here is the skeleton of my indicator, I kept the tastiest part for myself (I like myself very much, there is such a sin).

I understand that it is very crooked and it can be corrected. I am going to improve the main feature, namely, getting series values not by approximation, but it is one of the results of more than one year of my work.

 
Evgeniy Chumakov:
Eugene, thank you.

I seem to have been very inattentive and "ran" past the right buttons.

 

#define ctr 1// maximum delta between reference prices

This parameter can be changed (from 1 to the end), of course, positive integers (although take your chances, I can't vouch for the result).

How to make it changeable or at least as an external variable, I don't know yet.

 
Koprezer:

#define ctr 1// maximum delta between reference prices

input

 
Koprezer:
Eugene, thank you.

I seem to be very inattentive and "ran" past the right buttons.

And here, I've added horizontal lines, maybe something to help you visualize it.

Line_Povodok_001

--------------

I forgot to add in the code.

//+------------------------------------------------------------------+
//| Deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   ObjectsDeleteAll(0,InpFont1);
   ObjectsDeleteAll(0,InpFont2);
   ObjectsDeleteAll(0,InpFont3);
//---
  }
//+------------------------------------------------------------------+
Files:
 

Thought I'd give some theory to justify and interpret the indicator. Changed my mind, I want to hear your versions. You see the code, you get the pictures. I hope to hear logical options. I may pause for a while and if I see some interest I will give my version.

P/S Option with input did not work for me, if anyone has managed to help please.

 

now I've got it, at least you can make changes

что то в нём, Интересное есть 
#define  La 1000
//---
input int    Lactr    = 8;          //
input string InpFont1 = "LOW 1";    // Obj: Name Price
//---
double PraiseB,PraiseA,PraiseS;            // Средняя верхняя, средняя нижняя и просто средняя цены
uint   nB,nA,nS;                           // делители
int    NaxNole;                            // опорный бар
double LABuffer[], LBBuffer[], LSBuffer[]; // Бувера для визуализации индикатора
double Lad [La+2,3];                       // Массив возможных рассчитанных цен

EURUSDM30

EURUSDDaily

--------------------------------------------------------------------

with the MA indicator

EURUSDH2

Files: