Pinbar Detector Indicator For MT5
Table Of Contents:
- Pinbar Detector Indicator For MT5
- การติดตั้ง Pinbar Detector Indicator For MT5
- พารามิเตอร์ของ Pinbar Detector Indicator For MT5
- บัฟเฟอร์ของ Pinbar Detector Indicator For MT5
- ส่วนหลักของรหัส
Pinbar Detector Indicator For MT5 ทำให้การตรวจจับรูปแบบแท่งเทียนเป็นงานที่ยอดเยี่ยม Pinbars ใช้เพื่อแลกเปลี่ยนการพลิกกลับของแนวโน้มหรือความต่อเนื่องของแนวโน้ม (หลังจากการดึงกลับเสร็จสิ้น) ตัวบ่งชี้จุดการก่อตาซ้าย, จมูกและตาขวา
การติดตั้ง Pinbar Detector Indicator For MT5
หลังจากคุณดาวน์โหลดตัวบ่งชี้ผ่านแบบฟอร์มด้านบนคุณจะต้องทำการแตกไฟล์ zip จากนั้นคุณต้องคัดลอกไฟล์ pinbardetector.mq5 ลงในโฟลเดอร์ MQL5Indicators ของการติดตั้ง MT5 ของคุณ หลังจากนั้นโปรดรีสตาร์ท MT5 จากนั้นคุณจะเห็นตัวบ่งชี้ในรายการตัวบ่งชี้
พารามิเตอร์ของ Pinbar Detector Indicator For MT5
กระบวนการ Pinbar Detector Indicator For MT5 มีพารามิเตอร์ 12 เพื่อกำหนดค่า
input bool UseAlerts=true; // Permission to alerts input bool UseEmailAlerts=false; // Permission to email alerts input double MaxNoseBodySize = 0.33; // maximum allowable ratio of Nose body to the bar length input double NoseBodyPosition = 0.4; // extreme position of the Nose body inside the bar. Upper part for the bullish pattern, lower part to the bearish pattern input bool LeftEyeOppositeDirection=true; // Left eye should be bearish for the bullish Pin Bar and should be bullish for the bearish Pin Bar input bool NoseSameDirection=false; // the Nose should be in the same direction as the pattern itself input bool NoseBodyInsideLeftEyeBody=false; // the Nose body should be fit in the Left Eye body input double LeftEyeMinBodySize=0.1; // minimum size of the Left Eye body relatively to the bar length input double NoseProtruding=0.5; // minimum Nose protrusion relatively to the bar length input double NoseBodyToLeftEyeBody=1; // maximum size of the Nose body relatively to the Left Eye body input double NoseLengthToLeftEyeLength=0; // minimum Nose size relatively to the Left Eye input double LeftEyeDepth=0.1; // minimum depth of the Left Eye relatively to its length. Depth is the length of the bar part behind the Nose
บัฟเฟอร์ของ Pinbar Detector Indicator For MT5
Pinbar Detector Indicator For MT5 ให้บัฟเฟอร์ 2
SetIndexBuffer(0,UpDown,INDICATOR_DATA); SetIndexBuffer(1,Color,INDICATOR_COLOR_INDEX);
ส่วนหลักของรหัส
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &Open[], const double &High[], const double &Low[], const double &Close[], const long &tickvolume[], const long &volume[], const int &spread[]) { //---- int NeedBarsCounted; double NoseLength,NoseBody,LeftEyeBody,LeftEyeLength; //---- ArraySetAsSeries(Open,true); ArraySetAsSeries(High,true); ArraySetAsSeries(Low,true); ArraySetAsSeries(Close,true); //---- if(LastBars==rates_total) return(rates_total); NeedBarsCounted=rates_total-LastBars; LastBars=rates_total; if(NeedBarsCounted==rates_total) NeedBarsCounted--; //---- UpDown[0]=EMPTY_VALUE; //---- for(int bar=NeedBarsCounted; bar gt =1; bar--) { //---- Prevents bogus indicator arrows from appearing (looks like PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE); is not enough.) UpDown[bar]=EMPTY_VALUE; //---- Won t have Left Eye for the left-most bar if(bar==rates_total-1) continue; // Left Eye and Nose bars s paramaters NoseLength=High[bar]-Low[bar]; if(!NoseLength) NoseLength = _Point; LeftEyeLength = High[bar + 1] - Low[bar + 1]; if(!LeftEyeLength) LeftEyeLength=_Point; NoseBody=MathAbs(Open[bar]-Close[bar]); if(!NoseBody) NoseBody = _Point; LeftEyeBody = MathAbs(Open[bar + 1] - Close[bar + 1]); if(!LeftEyeBody) LeftEyeBody=_Point; //---- Bearish Pinbar if(High[bar]-High[bar+1] gt =NoseLength*NoseProtruding) // Nose protrusion { if(NoseBody/NoseLength lt =MaxNoseBodySize) // Nose body to candle length ratio { if(1 -(High[bar]-MathMax(Open[bar],Close[bar]))/NoseLength lt NoseBodyPosition) // Nose body position in bottom part of the bar { if(!LeftEyeOppositeDirection || Close[bar+1] gt Open[bar+1]) // Left Eye bullish if required { if(!NoseSameDirection || Close[bar] lt Open[bar]) // Nose bearish if required { if(LeftEyeBody/LeftEyeLength gt =LeftEyeMinBodySize) // Left eye body to candle length ratio { if(MathMax(Open[bar],Close[bar] lt =High[bar+1]) && MathMin(Open[bar],Close[bar]) gt =Low[bar+1]) // Nose body inside Left Eye bar { if(NoseBody/LeftEyeBody lt =NoseBodyToLeftEyeBody) // Nose body to Left Eye body ratio { if(NoseLength/LeftEyeLength gt =NoseLengthToLeftEyeLength) // Nose length to Left Eye length ratio { if(Low[bar]-Low[bar+1] gt =LeftEyeLength*LeftEyeDepth) // Left Eye low is low enough { if(!NoseBodyInsideLeftEyeBody || MathMax(Open[bar],Close[bar]) lt =MathMax(Open[bar+1],Close[bar+1]) && MathMin(Open[bar],Close[bar]) gt =MathMin(Open[bar+1],Close[bar+1])) // Nose body inside Left Eye body if required { UpDown[bar]= High[bar]+5 * _Point+NoseLength/5; Color[bar] = 1; if(bar==1) SendAlert("Bearish"); // Send alerts only for the latest fully formed bar } } } } } } } } } } } //---- Bullish Pinbar if(Low[bar+1]-Low[bar] gt =NoseLength*NoseProtruding) // Nose protrusion { if(NoseBody/NoseLength lt =MaxNoseBodySize) // Nose body to candle length ratio { if(1 -(MathMin(Open[bar],Close[bar])-Low[bar])/NoseLength lt NoseBodyPosition) // Nose body position in top part of the bar { if(!LeftEyeOppositeDirection || Close[bar+1] lt Open[bar+1]) // Left Eye bearish if required { if(!NoseSameDirection || Close[bar] gt Open[bar]) // Nose bullish if required { if(LeftEyeBody/LeftEyeLength gt =LeftEyeMinBodySize) // Left eye body to candle length ratio { if(MathMax(Open[bar],Close[bar] lt =High[bar+1]) && (MathMin(Open[bar],Close[bar]) gt =Low[bar+1])) // Nose body inside Left Eye bar { if(NoseBody/LeftEyeBody lt =NoseBodyToLeftEyeBody) // Nose body to Left Eye body ratio { if(NoseLength/LeftEyeLength gt =NoseLengthToLeftEyeLength) // Nose length to Left Eye length ratio { if(High[bar+1]-High[bar] gt =LeftEyeLength*LeftEyeDepth) // Left Eye high is high enough { if(!NoseBodyInsideLeftEyeBody || MathMax(Open[bar],Close[bar]) lt =MathMax(Open[bar+1],Close[bar+1]) && MathMin(Open[bar],Close[bar]) gt =MathMin(Open[bar+1],Close[bar+1])) // Nose body inside Left Eye body if required { UpDown[bar]= Low[bar]-5 * _Point-NoseLength/5; Color[bar] = 0; if(bar==1) SendAlert("Bullish"); // Send alerts only for the latest fully formed bar } } } } } } } } } } } } //---- return(rates_total); } //+------------------------------------------------------------------+ //| Getting string timeframe | //+------------------------------------------------------------------+ string TimeframeToString(ENUM_TIMEFRAMES timeframe) {return(StringSubstr(EnumToString(timeframe),7,-1));} //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void SendAlert(string dir) { //---- string per=TimeframeToString(_Period); if(UseAlerts) { Alert(dir+" Pinbar on ",_Symbol," @ ",per); PlaySound("alert.wav"); } if(UseEmailAlerts) SendMail(_Symbol+" @ "+per+" - "+dir+" Pinbar",dir+" Pinbar on "+_Symbol+" @ "+per+" as of "+TimeToString(TimeCurrent())); //---- } //+------------------------------------------------------------------+