Indicators Used
Bulls Power indicator Bears Power indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
DC_signals
//+------------------------------------------------------------------+
//|                                                   DC signals.mq4 |
//|                                      DC2008 Copyright © 2008-2011|
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1  Yellow
#property indicator_color2  Aqua
#property indicator_color3  Red
#property indicator_color4  White
#property indicator_color5  Red
#property indicator_color6  Blue
#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 1
#property indicator_width4 0
#property indicator_width5 3
#property indicator_width6 3

extern int  history=500; // Êîëè÷åñòâî áàðîâ äëÿ àíàëèçà
double DCOS[];
double BULLSBEARS[];
double BufferUPDown[];
double Buffer1[];
double Buffer2[];
double Buffer3[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,119);
   SetIndexBuffer(0,DCOS);

   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,119);
   SetIndexBuffer(1,BULLSBEARS);

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,159);
   SetIndexBuffer(2,BufferUPDown);
   SetIndexEmptyValue(2,0.0);

   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,161);
   SetIndexBuffer(3,Buffer1);
   SetIndexEmptyValue(3,0.0);

   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,178);
   SetIndexBuffer(4,Buffer2);
   SetIndexEmptyValue(4,0.0);

   SetIndexStyle(5,DRAW_ARROW);
   SetIndexArrow(5,178);
   SetIndexBuffer(5,Buffer3);
   SetIndexEmptyValue(5,0.0);
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   for(int i=history; i>=0; i--)
     {
      BufferUPDown[i]=NULL;
      Buffer1[i]=NULL;
      Buffer2[i]=NULL;
      Buffer3[i]=NULL;
     }
   DCOS[history+1]=0.0;
   for(i=history; i>=0; i--)
     {
      BULLSBEARS[i]=iBullsPower(NULL,0,21,0,i)
                    +iBearsPower(NULL,0,21,0,i);

      if(Close[i]>Open[i]) DCOS[i]=DCOS[i+1]+Volume[i];
      if(Close[i]==Open[i]) DCOS[i]=DCOS[i+1];
      if(Close[i]<Open[i]) DCOS[i]=DCOS[i+1]-Volume[i];

      if(Close[i]>(High[i]+Low[i])/2) DCOS[i]+=Volume[i];
      if(Close[i]<(High[i]+Low[i])/2) DCOS[i]-=Volume[i];

      if(Close[i]>(High[i]+Low[i]+Open[i])/3) DCOS[i]+=Volume[i];
      if(Close[i]<(High[i]+Low[i]+Open[i])/3) DCOS[i]-=Volume[i];

      if(Close[i]>((High[i]+Low[i])/2+Open[i])/2) DCOS[i]+=Volume[i];
      if(Close[i]<((High[i]+Low[i])/2+Open[i])/2) DCOS[i]-=Volume[i];
     }

   for(i=history; i>=1; i--)
     {
      if(DCOS[i]<DCOS[i+1] && BULLSBEARS[i]>BULLSBEARS[i+1]) BufferUPDown[i]=High[i];
      if(DCOS[i]>DCOS[i+1] && BULLSBEARS[i]<BULLSBEARS[i+1]) BufferUPDown[i]=Low[i];

      if(DCOS[i]<DCOS[i+1] && DCOS[i+2]<DCOS[i+1]) Buffer1[i]=High[i];
      if(DCOS[i]>DCOS[i+1] && DCOS[i+2]>DCOS[i+1]) Buffer1[i]=Low[i];

      if(DCOS[i]<DCOS[i+1] && BULLSBEARS[i]>BULLSBEARS[i+1]
         && DCOS[i]>DCOS[i-1] && BULLSBEARS[i]>BULLSBEARS[i-1])
         Buffer2[i]=Low[i];
      if(DCOS[i]>DCOS[i+1] && BULLSBEARS[i]<BULLSBEARS[i+1]
         && DCOS[i]<DCOS[i-1] && BULLSBEARS[i]<BULLSBEARS[i-1])
         Buffer3[i]=High[i];
     }
   for(i=history; i>=0; i--)
     {
      DCOS[i]=NULL;
      BULLSBEARS[i]=NULL;
     }
   for(i=history; i>=1; i--)
     {
      DCOS[i]=Buffer2[i];
      BULLSBEARS[i]=Buffer3[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 ---