//+------------------------------------------------------------------+ //| fractal_2lev.mq4 | //| Copyright © 2006, HexSys | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, HexSys" #property link "" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 DimGray #property indicator_color2 DimGray #property indicator_color3 Red #property indicator_color4 Blue //---- input parameters extern int BARS=100; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,217); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,218); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,217); SetIndexBuffer(2,ExtMapBuffer3); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,218); SetIndexBuffer(3,ExtMapBuffer4); SetIndexEmptyValue(3,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=BARS;//IndicatorCounted(); //---- for(int i=1;i<BARS;i++) { if (High[i]>High[i+1] && High[i]>High[i-1]) ExtMapBuffer1[i]=High[i]; if (Low[i]<Low[i+1] && Low[i]<Low[i-1]) ExtMapBuffer2[i]=Low[i]; } int h1=0,h2=0,h3=0,ht=0; int l1=0,l2=0,l3=0,lt=0; for(i=1;i<BARS;i++) { if(ExtMapBuffer1[i]!=0) { h3=h2; h2=h1; h1=i; if (High[h2]>High[h3] && High[h2]>High[h1]) ExtMapBuffer3[h2]=High[h2]; } if(ExtMapBuffer2[i]!=0) { l3=l2; l2=l1; l1=i; if (Low[l2]<Low[l3] && Low[l2]<Low[l1]) ExtMapBuffer4[l2]=Low[l2]; } } //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: