DynFloatPivotM

Author: Copyright � 2006, Nick A. Zhilin
DynFloatPivotM
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
DynFloatPivotM
//+------------------------------------------------------------------+
//|                                                DynFloatPivot.mq4 |
//|                                 Copyright © 2006, Nick A. Zhilin |
//|                                              rebus@dialup.etr.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Nick A. Zhilin"
#property link      "rebus@dialup.etr.ru"
//----
extern int IPeriod = 96;
extern string note = "Buff:1P;2HP;3LP;4HL/2;5HP/2;6LP/2;7HLPP/2";

//----
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Sienna //P
#property indicator_color2 Aqua //HP
#property indicator_color3 Red    //LP
#property indicator_color4 Gray  //HL/2
#property indicator_color5 Teal    //HP/2
#property indicator_color6 Maroon    //LP/2
#property indicator_color7 Yellow  //HLPP/2

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("Float Pivot");
//---- indicators
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexLabel(0, "Pivot");
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexLabel(1, "HP");
   SetIndexStyle(2, DRAW_LINE);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexLabel(2, "LP");

   SetIndexStyle(3, DRAW_LINE);
   SetIndexBuffer(3, ExtMapBuffer4);
   SetIndexLabel(3, "HL/2");

   SetIndexStyle(4, DRAW_LINE);
   SetIndexBuffer(4, ExtMapBuffer5);
   SetIndexLabel(4, "HP/2");

   SetIndexStyle(5, DRAW_LINE);
   SetIndexBuffer(5, ExtMapBuffer6);
   SetIndexLabel(5, "LP/2");
  
   SetIndexStyle(6, DRAW_LINE);
   SetIndexBuffer(6, ExtMapBuffer7);
   SetIndexLabel(6, "HLPP/4");
//---
 IndicatorShortName("DynFloatPivot(" + IPeriod + ")");

//----
 //  Comment("FloatPivot(" + IPeriod + ")");
//----
   return(0);
  }
int deinit()
  {
   Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Float Pivot                                                      |
//+------------------------------------------------------------------+
int start()
  {
   int i, counted_bars = IndicatorCounted();
//----
   i = Bars - counted_bars - 1;
   while(i >= 0)
     {
       double max = High[Highest(NULL, 0, MODE_HIGH, IPeriod, i)];
       double min = Low[Lowest(NULL, 0, MODE_LOW, IPeriod, i)];
       double pivot = (Close[i+1] + Close[i+2] + Close[i+3]) / 3;
       // Pivot
       ExtMapBuffer1[i] = (max + min + pivot) / 3; // HLP/3
       // (R1 - Pivot) / 2
       ExtMapBuffer2[i] = ((2*(max + min + pivot) / 3 - min) + 
                           (max+min+pivot) / 3) / 2;  // HP
       // (Pivot - S1) / 2
       ExtMapBuffer3[i] = ((max + min + pivot) / 3 + 
                           (2*(max + min + pivot) / 3 - max)) / 2;// LP
   
   
       ExtMapBuffer4[i] = (max + min) / 2;

          ExtMapBuffer5[i] = (ExtMapBuffer1[i]+ExtMapBuffer2[i])/2;  //HP/2
          ExtMapBuffer6[i] = (ExtMapBuffer1[i]+ExtMapBuffer3[i])/2;  //LP/2
         
          ExtMapBuffer7[i] = (max + min + pivot + pivot) / 4;        //HLPP/2

   
       i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---