Author: Copyright � 2006, EvgeniX
5_bar_sig
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
5_bar_sig
//+------------------------------------------------------------------+
//|                                                       5 Bars.mq4 |
//|                      Copyright © 2006, EvgeniX                   |
//|                                        
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, EvgeniX"
#property link      "EvgeniX"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_width1 1
#property indicator_color2 Yellow
#property indicator_width2 1

#property indicator_level1 0

extern int NrOfBars=500;
extern int bars1 = 5;


//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double fhigh;
double flow;
double fclose;
double shigh;
double slow;
double sclose;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,EMPTY_VALUE);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//---- 
   for(int i=1  ;i<=NrOfBars;i++)
     {
      
      shigh=High[iHighest(NULL, 0,2,bars1,i)];
      slow=Low[iLowest(NULL,0,1,bars1,i)];
      sclose=Close[i];
      fhigh=High[iHighest(NULL, 0, 2, bars1, (i+bars1))];
      flow=Low[iLowest(NULL,0,1,bars1,(i+bars1))];
      fclose=Close[i+bars1];
 
      if ((shigh>fhigh) && (sclose<flow))
        {//SELL
         ExtMapBuffer1[i+5]=-1;//High[i+5]+0.0005;
        }
      if ((slow<flow) && (sclose>fhigh))
        {//BUY
         ExtMapBuffer1[i+5]=1;//Low[i+5]-0.0005;
        }
     // Print(ExtMapBuffer2[i+5]);  
     }
  
//----
   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 ---