Author: Copyright � 2005, MetaQuotes Software Corp.
Speed5
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Speed5
//+------------------------------------------------------------------+
//|                                                 Speed.mq4        |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LightSeaGreen
#property indicator_color2 Red
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("");
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Accumulation/Distribution                                        |
//+------------------------------------------------------------------+
int start()
  {
   int i,n,Bars1,counted_bars=IndicatorCounted();
   RefreshRates();
//----
   //i=0;
   //n=Bars-counted_bars-1;
   //while(i<=n)
   Bars1=Bars/2;
   i=Bars1;//Bars-counted_bars-1;
   while(i>=0)   
   {
      double high0 =High[i];
      double low0  =Low[i];
      double open0 =Open[i];
      double close0=Close[i];
      double pips0=close0/Point;
      double vol0=Volume[i];
      
      double high1 =High[i+1];
      double low1  =Low[i+1];
      double open1 =Open[i+1];
      double close1=Close[i+1];
      double pips1=close1/Point;
      double vol1=Volume[i+1];
      
      double high2 =High[i+2];
      double low2  =Low[i+2];
      double open2 =Open[i+2];
      double close2=Close[i+2];
      double pips2=close2/Point;
      double vol2=Volume[i+2];    
      
      double x1=(vol0-vol1);
      if(x1==0)x1=1;
      double x2=(vol1-vol2);
      if(x2==0)x2=1;
      
      double vit1=(close0-close1)/x1;  
      double vit2=(close1-close2)/x2;  
      
      double vit3=(high0-low0)/x1;  
      double vit4=(high1-low1)/x2; 
      //ExtMapBuffer1[i]=ExtMapBuffer1[i+1]+Volume[i];             
      ExtMapBuffer1[i]=MathCos(2*3.1415*i/Point);//(close0-close1);//iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)-iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1);//buy //-vit4;  //(close-low)-(high-close);
      //ExtMapBuffer2[i]=-i;//vit3*20;//-(iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,0)-iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,1));//sell
      /*
      if(ExtMapBuffer1[i]!=0)
      {
         double diff=high-low;
         if(0==diff)
            ExtMapBuffer1[i]=0;
         else
         {
            ExtMapBuffer1[i]/=diff;
            ExtMapBuffer1[i]*=Volume[i];
         }
      }*/
      if(i<Bars1-1) 
      {
        ExtMapBuffer1[i]-=ExtMapBuffer1[i+1];
        //ExtMapBuffer2[i]-=ExtMapBuffer2[i+1];
      }  
      
      
      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 ---