//------------------------------------------------------------------/ // PA IO detection v2.mq4 // //------------------------------------------------------------------/ #property copyright "mason" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Chocolate #property indicator_color2 Chocolate #property indicator_color3 OrangeRed #property indicator_color4 OrangeRed #property indicator_color5 Chocolate #property indicator_color6 Chocolate #property indicator_color7 OrangeRed #property indicator_color8 OrangeRed extern bool ShowIB=false; extern bool ShowINB=true; extern bool ShowOB=true; extern bool ShowStrongOB=true; extern double PreviousInsideBars=4; extern double PercentOBClosefromStart=50; extern double PercentOBClosetoEnd=20; extern int backperiod=10; extern double IBPercentLabel=40; extern double INBPercentLabel=80; extern double OBPercentLabel=50; extern double SOBPercentLabel=100; double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; double ExtMapBuffer8[]; int init() { SetIndexStyle(0,DRAW_ARROW,0,1); //Inside Bar Up SetIndexArrow(0,241); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexLabel(0,"IB Up"); SetIndexStyle(1,DRAW_ARROW,0,1); //Inside Bar Down SetIndexArrow(1,242); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); SetIndexLabel(1,"IB Down"); SetIndexStyle(2,DRAW_ARROW,0,2); //I4B Up SetIndexArrow(2,241); SetIndexBuffer(2,ExtMapBuffer3); SetIndexEmptyValue(2,0.0); SetIndexLabel(2,"INB Up"); SetIndexStyle(3,DRAW_ARROW,0,2); //I4B Down SetIndexArrow(3,242); SetIndexBuffer(3,ExtMapBuffer4); SetIndexEmptyValue(3,0.0); SetIndexLabel(3,"INB Down"); SetIndexStyle(4,DRAW_ARROW,0,1); //Outside Bar Up SetIndexArrow(4,233); SetIndexBuffer(4,ExtMapBuffer5); SetIndexEmptyValue(4,0.0); SetIndexLabel(4,"BUOB Up"); SetIndexStyle(5,DRAW_ARROW,0,1); //Outside Bar Down SetIndexArrow(5,234); SetIndexBuffer(5,ExtMapBuffer6); SetIndexEmptyValue(5,0.0); SetIndexLabel(5,"BEOB Down"); SetIndexStyle(6,DRAW_ARROW,0,2); //Strong Outside Bar Up SetIndexArrow(6,233); SetIndexBuffer(6,ExtMapBuffer7); SetIndexEmptyValue(6,0.0); SetIndexLabel(6,"Strong BUOB Up"); SetIndexStyle(7,DRAW_ARROW,0,2); //Strong Outside Bar Down SetIndexArrow(7,234); SetIndexBuffer(7,ExtMapBuffer8); SetIndexEmptyValue(7,0.0); SetIndexLabel(7,"Strong BEOB Down"); return(0); } int deinit() { } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double range,rangecurrent; int limit,count,count2,baratr; int counted_bars=IndicatorCounted(); bool nb,ib,ob,tbh,tbl; double buff1[],buff2[]; //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; if (backperiod==0) limit=Bars-counted_bars; else limit=backperiod; if (Bars<400) baratr=Bars/2; else baratr=200; ArrayResize(buff1,limit+baratr); ArrayResize(buff2,baratr); for(int i2=limit+baratr; i2>=0; i2--) buff1[i2]=iATR(NULL,0,1,i2); //---- main loop for(int i=limit; i>=0; i--) { range=iMAOnArray(buff1,Bars,baratr,0,0,i); // for arrow position rangecurrent=High[i]-Low[i]; ExtMapBuffer1[i]=0; ExtMapBuffer2[i]=0; ExtMapBuffer3[i]=0; ExtMapBuffer4[i]=0; ExtMapBuffer5[i]=0; ExtMapBuffer6[i]=0; ExtMapBuffer7[i]=0; ExtMapBuffer8[i]=0; // Inside Bar if ((ShowIB)||(ShowINB)&&(i!=0)) if ((High[i]<High[i+1])&&(Low[i]>Low[i+1])) { if (ShowIB) { ExtMapBuffer1[i] = High[i]+(IBPercentLabel/100*range); ExtMapBuffer2[i] = Low[i]-(IBPercentLabel/100*range); } if (ShowINB) { bool rangesmaller=true; for (int i3=2;i3<PreviousInsideBars;i3++) { if ((High[i+i3]-Low[i+i3])<(High[i]-Low[i])) { rangesmaller=false; break; } } if (rangesmaller) { ExtMapBuffer3[i] = High[i]+(INBPercentLabel/100*range); ExtMapBuffer4[i] = Low[i]-(INBPercentLabel/100*range); } } } // Outside Bar if ((ShowOB)||(ShowStrongOB)) if ((High[i]>High[i+1])&&(Low[i]<Low[i+1])) { if (ShowOB) { if ((Open[i]<Close[i])&&(Close[i]>PercentOBClosefromStart/100*rangecurrent+Low[i])) ExtMapBuffer5[i] = High[i]+(OBPercentLabel/100*range); if ((Open[i]>Close[i])&&(Close[i]<High[i]-PercentOBClosefromStart/100*rangecurrent)) ExtMapBuffer6[i] = Low[i]-(OBPercentLabel/100*range); } if (ShowStrongOB) { if ((Open[i]<Close[i])&&(Close[i]>High[i+1])&&((High[i]-Close[i])<(PercentOBClosetoEnd/100*rangecurrent))) ExtMapBuffer7[i] = High[i]+(SOBPercentLabel/100*range); if ((Open[i]>Close[i])&&(Close[i]<Low[i+1])&&((Close[i]-Low[i])<(PercentOBClosetoEnd/100*rangecurrent))) ExtMapBuffer8[i] = Low[i]-(SOBPercentLabel/100*range); } } } //for return(0); } //start() //+------------------------------------------------------------------+
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
Series array that contains close prices for each bar
Series array that contains open prices of each bar
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Indicators Used:
Indicator of the average true range
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: