차이 미적분, 예.

 

이 스레드에서 차이 계산을 기반으로 하는 지표와 전문가를 오픈 소스로 수집할 것을 제안합니다.

시간이 지남에 따라 관심이 있다면 우리는 가치있는 것을 수집하거나 그릴 것입니다. :)

예를 들어 더 시각적인 버전 으로 표시기를 다시 작성했습니다 .

 //|                                Copyright 2016, Aleksey Panfilov. |
//|                                                filpan1@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2018, Aleksei Panfilov. filpan1@yandex.ru"
#property link        "filpan1@yandex.ru"
#property version    "1.2"
#property description      "2018_01_10_Polynom_s4_s2_p72"
#property strict

#include <MovingAverages.mqh>


#property indicator_chart_window
#property indicator_buffers 6
#property indicator_plots    2
//--- plot a1_
#property indicator_label1    "MACD"
#property indicator_type1    DRAW_LINE
#property indicator_color1    clrSilver
#property indicator_style1    STYLE_SOLID
#property indicator_width1    2
//--- plot a2_
#property indicator_label2    "Signal"
#property indicator_type2    DRAW_LINE
#property indicator_color2    clrRed
#property indicator_style2    STYLE_SOLID
#property indicator_width2    1
//--- plot a3_
#property indicator_label3    "Fast_line_1"
#property indicator_type3    DRAW_LINE
#property indicator_color3    clrBlueViolet
#property indicator_style3    STYLE_SOLID
#property indicator_width3    6
//--- plot a4_
#property indicator_label4    "Fast_line_2"
#property indicator_type4    DRAW_LINE
#property indicator_color4    clrBlue
#property indicator_style4    STYLE_SOLID
#property indicator_width4    1
//--- plot a5_
#property indicator_label5    "Slow_line_1"
#property indicator_type5    DRAW_LINE
#property indicator_color5    clrDarkGreen
#property indicator_style5    STYLE_SOLID
#property indicator_width5    4
//--- plot a6_
#property indicator_label6    "Slow_line_2"
#property indicator_type6    DRAW_LINE
#property indicator_color6    clrRed
#property indicator_style6    STYLE_SOLID
#property indicator_width6    1 //--- input parameters

//         int   LIN_1_STEP    =4; //line_1_power
//input int      LIN_1_PLECHO  =72; //Fast_line_1_leverage
//         int   LIN_2_STEP    =2;//line_2_power
//input int      LIN_2_PLECHO  =78; //Fast_line_2_leverage
//         int   LIN_3_STEP    =4;//line_3_power
//input int      LIN_3_PLECHO  =72; //Slow_line_1_leverage
//         int   LIN_4_STEP    =2;//Slow_line_4_power
//input int      LIN_4_PLECHO  =72;//Slow_line_2_leverage

input          int TOCHKA_VHODA = 300 ; // start_point
//input int           base  =450;
       int    point_shift_1 = 0 ;
       int    point_shift_2 = 0 ;
//input int   Multiplikator = 10;
//input int   InpSignalSMA  = 9;  // Signal SMA Period



//--- indicator buffers

double a1_Buffer[];
double a2_Buffer[];
double a3_Buffer[];
double a4_Buffer[];
double a5_Buffer[];
double a6_Buffer[];
//double a7_Buffer[];
//double a8_Buffer[];
/**/


//===========================================================================================
   double Znach;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
 
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,a5_Buffer, INDICATOR_DATA );
   SetIndexBuffer ( 1 ,a6_Buffer, INDICATOR_DATA );
   SetIndexBuffer ( 2 ,a1_Buffer, INDICATOR_DATA );
   SetIndexBuffer ( 3 ,a2_Buffer, INDICATOR_DATA );
   SetIndexBuffer ( 4 ,a3_Buffer, INDICATOR_DATA );
   SetIndexBuffer ( 5 ,a4_Buffer, INDICATOR_DATA );
//----
//----
   SetIndexShift ( 2 ,- 72 );
   SetIndexShift ( 5 , 20 );

//    if(TOCHKA_VHODA <= (LIN_1_PLECHO+25)*LIN_1_INTERVAL) TOCHKA_VHODA=(LIN_1_PLECHO+25)*LIN_1_INTERVAL;  
//    if(TOCHKA_VHODA <= (LIN_2_PLECHO+25)*LIN_2_INTERVAL) TOCHKA_VHODA=(LIN_2_PLECHO+25)*LIN_2_INTERVAL;  
//    if(TOCHKA_VHODA <= (LIN_3_PLECHO+25)*LIN_3_INTERVAL) TOCHKA_VHODA=(LIN_3_PLECHO+25)*LIN_3_INTERVAL;  
//    if(TOCHKA_VHODA <= (LIN_4_PLECHO+25)*LIN_4_INTERVAL) TOCHKA_VHODA=(LIN_4_PLECHO+25)*LIN_4_INTERVAL;  
//    if(TOCHKA_VHODA <= (base*2+25))                      TOCHKA_VHODA=(base*2+25);  

//------
//===========================================================================================
//===========================================================================================

   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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 i,z,limit;
//   int Bars=Bars(_Symbol,_Period);

   if (prev_calculated== 0 ) // first calculation    
     {
      limit=rates_total-TOCHKA_VHODA;
       //--- set empty value for first limit bars
//Print("Bars=",Bars," rates_total=",rates_total," TOCHKA=",TOCHKA_VHODA," limit=",limit);
       if (limit< 1 ) return ( 0 );
       for (i=rates_total- 1 ;i>=limit;i--)
      {
       a1_Buffer[i]=open[limit+ 1 ];
       a2_Buffer[i]=open[limit+ 1 ];
       a3_Buffer[i]=open[limit+ 1 ];
       a4_Buffer[i]=open[limit+ 1 ];
       a5_Buffer[i]=open[limit+ 1 ];
       a6_Buffer[i]=open[limit+ 1 ];
      }

     }
   else limit=rates_total-prev_calculated;
//--- main loop
   for (i=limit;i>= 0 && ! IsStopped ();i--)
   {
//===========================================================================================
   Znach = 0 ; //iMA(NULL,0,base*2,0,MODE_SMA,PRICE_OPEN,i);
//===========================================================================================

 
      a1_Buffer[i]=((open[i] - Znach)    + 5061600 *a1_Buffer[i+ 1 ]- 7489800    *a1_Buffer[i+ 2 ]+ 4926624 *a1_Buffer[i+ 3 ]- 1215450 *a1_Buffer[i+ 4 ])/ 1282975 ;

      a2_Buffer[i]=   3160 *a1_Buffer[i]   - 6240    *a1_Buffer[i+ 1 ]    +   3081 *a1_Buffer[i+ 2 ];

      a4_Buffer[i+ 92 ]=a1_Buffer[i];   if (i<= 10 ) { for (z= 92 - 1 ;z>= 0 ;z--){        a4_Buffer[i+ 0 +z]=   5 *a4_Buffer[i+ 1 +z]  -   10 *a4_Buffer[i+ 2 +z]   +   10 *a4_Buffer[i+ 3 +z]  -   5 *a4_Buffer[i+ 4 +z]  +   1 *a4_Buffer[i+ 5 +z];  }}


//      a3_Buffer[i]=((open[i] - Znach)    +5061600*a3_Buffer[i+1 ]-7489800    *a3_Buffer[i+2 ]+4926624*a3_Buffer[i+3 ]-1215450*a3_Buffer[i+4 ])/1282975;

//      a4_Buffer[i]=  2701*a3_Buffer[i]   -5328   *a3_Buffer[i+1 ]    +  2628 *a3_Buffer[i+2 ];



//================================================================================================================================================================================================
//================================================================================================================================================================================================

//   a5_Buffer[i] = (a2_Buffer[i+point_shift_1] - a4_Buffer[i+point_shift_2])* Multiplikator;

   } 
//----
//--- signal line counted in the 2-nd buffer

//     SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,a5_Buffer,a6_Buffer);

//--- done

//--- return value of prev_calculated for next call
   return (rates_total);
  }
//+------------------------------------------------------------------+
 

차이 미적분이란 무엇입니까?

이것:

Δ f (x k ) \u003d f (x k+1 ) - f (x k )

 
알렉세이 판필로프 :

이 스레드에서 차이 계산을 기반으로 하는 지표와 전문가를 오픈 소스로 수집할 것을 제안합니다.

예를 들어 더 시각적인 버전 으로 표시기를 다시 작성했습니다 .

차트에는 다음과 같이 표시됩니다.



숄더가 72인 4차 다항식에 의한 청-적색 선 보간(구간 내부의 점 찾기).

      a1_Buffer[i]=((open[i] - Znach)    + 5061600 *a1_Buffer[i+ 1 ]- 7489800    *a1_Buffer[i+ 2 ]+ 4926624 *a1_Buffer[i+ 3 ]- 1215450 *a1_Buffer[i+ 4 ])/ 1282975 ;

가는 파란색 선은 숄더가 78인 2차 다항식에 의한 외삽(구간 외부의 점 찾기)입니다.

 a2_Buffer[i]=   3160 *a1_Buffer[i]   - 6240    *a1_Buffer[i+ 1 ]    +   3081 *a1_Buffer[i+ 2 ];

빨간색, 이것은 4차 다항식을 구성하기 위한 선입니다. 마지막 막대의 시작점을 기준으로 다시 그려집니다.

 a4_Buffer[i+ 92 ]=a1_Buffer[i];   if (i<= 10 ) { for (z= 92 - 1 ;z>= 0 ;z--){        a4_Buffer[i+ 0 +z]=   5 *a4_Buffer[i+ 1 +z]  -   10 *a4_Buffer[i+ 2 +z]   +   10 *a4_Buffer[i+ 3 +z]  -   5 *a4_Buffer[i+ 4 +z]  +   1 *a4_Buffer[i+ 5 +z];  }}

 
예브게니 벨랴예프 :

차이 미적분이란 무엇입니까?

이것:

Δ f (x k ) \u003d f (x k+1 ) - f (x k )


네.

이것은 Newton의 이항식과 직접 관련이 있습니다.

등거리 점의 경우 사실입니다.

1 *Y1- 2 *Y2+ 1 *Y3=0 - 직선의 미분 방정식.

1 *Y1- 3 *Y2+ 3 *Y3- 1 *Y4 =0 - 2차 포물선의 미분 방정식.

1 *Y1- 4 *Y2+ 6 *Y3- 4 *Y4 + 1 *Y5 =0 - 3차 포물선의 미분 방정식.

또한 테마와 교차:

https://www.mql5.com/ru/forum/61389/page48#comment_5633264

https://www.mql5.com/en/forum/211220/page2#comment_5632736 .

Как измерить скорость цены
Как измерить скорость цены
  • 2017.07.20
  • www.mql5.com
Всем привет, тут такая тема Хочу использовать "ускорение" цены на тиковых интервалах, но не пойму как вообще посчитать скорость цены...
 
알렉세이 판필로프 :

네.


모두가 이것을했습니다 ... 그들은 썼습니다 ...

미래는 과거에 의존하는가?

 
예브게니 벨랴예프 :

모두가 이것을했습니다 ... 그들은 썼습니다 ...

미래는 과거에 의존하는가?


모든 행동에 대해 현재에 흔적이 발생하며 이는 물론 미래에 영향을 미칩니다. :)))))

나는 철학 없이 이 스레드에서 제안합니다. 수학, 프로그래밍, 테스트, 최적화만 합시다.

 
알렉세이 판필로프 :

네.

이것은 Newton의 이항식과 직접 관련이 있습니다.

등거리 점의 경우 사실입니다.

Y1-2*Y2+Y3=0 - 직선의 미분 방정식.

Y1-3*Y2+3*Y3-Y4 =0 - 2차 포물선의 차분 방정식.

Y1-4*Y2+6*Y3-4*Y4 + Y5 =0 - 3차 포물선의 미분 방정식.

이 공식을 시도 했습니까?

Y = a0 + a1X + a2X^2 + a3X^3 + a4X^4

어디:

X - 이전 막대의 가격

Y - 현재 막대의 가격.


이 그림이 나옵니다.


 
Yousufkhodja 술토노프 :

이 공식을 사용해 보셨습니까?

Y = a + bX + cX^2 + dX^3 + eX^4


물론 이 형태에는 X와 Y가 있지만, 재귀방정식에서는 Y만 있고 모든 계수( a + b X + c X ^ 2 + d X ^ 3 + e X ^ 4)를 5개로 대체한다. Y 자체의 값.

 

코드를 보니 제대로 이해했습니다. 피드백이 포함된 일종의 필터인가요? 그리고 계수 5061600, 4926624 등은 어디에서 왔습니까?

일반적으로 칠면조는 tyrnet에서 어디에서 왔습니까? ))

 
알렉세이 볼찬스키 :

1. 코드를 봤는데, 제대로 이해했나요. 피드백이 있는 필터인가요?

2. 그리고 계수 5061600, 4926624 등은 어디에서 왔습니까?

3. 일반적으로 칠면조는 tyrnet에서 어디에서 왔습니까? ))

1. 네. 이 필터는 400년이 넘었으며 데카르트, 뉴턴, 파스칼, 테일러, 라그랑주와 같은 서면 출처가 있는 이야기만 있습니다.

2. 확률이 계산됩니다. 두 번째 해에 그들은 Lagrange와 Taylor의 방법을 알게 된 것 같습니다. 계수 계산을 위한 많은 옵션이 있습니다.

3. 특히 이것은 오늘 그렸습니다. :))))))

 

샘플이 N=100으로 증가하면 4차 방정식은 다음 결과를 제공합니다.