//+------------------------------------------------------------------+ //| ZZZ_STF_CCI50_2PXNR_STD.mq4 //+------------------------------------------------------------------+ #property copyright "AHGduP" #property link "ZZZ_STF_CCI50_2PXNR_STD" #property indicator_separate_window #property indicator_buffers 8 #property indicator_color1 Lime #property indicator_color2 Red #property indicator_color3 Lime #property indicator_color4 Red #property indicator_color5 Aqua #property indicator_color6 Magenta #property indicator_color7 Aqua//Lime #property indicator_color8 Magenta//Red #property indicator_maximum 4.9 #property indicator_minimum 0.4 //=================================================================================== extern int CCI_WIN5_SM =1 ; string Input1 = "== CCI ==="; extern int CCI50_1M = 50 ; extern int CCI15_1M = 15; extern int CCI50_5M = 50 ; extern int CCI15_5M = 15 ; extern int CCI50_15M = 50 ; extern int CCI15_15M = 15 ; extern int CCI50_30M = 50 ; extern int CCI15_30M = 15 ; extern int CCI50_60M = 50 ; extern int CCI15_60M = 15 ; //=================================================================================== extern int DotSize_110_167 = 110 ; //167 extern int ArrowSize = 6 ; extern int CountBars = 600000 ; extern int TFA = 5 ;//0 vir al 4. extern int TFB = 15 ; extern int TFC = 30 ; extern int TFD = 60 ; bool StepTFA_Up = true; bool StepTFB_Up = true; bool StepTFC_Up = true; bool StepTFD_Up = true; double cci50Am_up , cci50Am_dn ; double cci15Am_up, cci15Am_dn; double cci50Bm_up , cci50Bm_dn ; double cci15Bm_up, cci15Bm_dn; double cciCm_up , cciCm_dn ; double cciDm_up , cciDm_dn ; double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; double ExtMapBuffer8[]; //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,DotSize_110_167); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,DotSize_110_167); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,DotSize_110_167); SetIndexBuffer(2,ExtMapBuffer3); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,DotSize_110_167); SetIndexBuffer(3,ExtMapBuffer4); SetIndexEmptyValue(3,0.0); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,DotSize_110_167); SetIndexBuffer(4,ExtMapBuffer5); SetIndexEmptyValue(4,0.0); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,DotSize_110_167); SetIndexBuffer(5,ExtMapBuffer6); SetIndexEmptyValue(5,0.0); SetIndexStyle(6,DRAW_ARROW); SetIndexArrow(6,DotSize_110_167); SetIndexBuffer(6,ExtMapBuffer7); SetIndexEmptyValue(6,0.0); SetIndexStyle(7,DRAW_ARROW); SetIndexArrow(7,DotSize_110_167); SetIndexBuffer(7,ExtMapBuffer8); SetIndexEmptyValue(7,0.0); //------------------------------------ string short_name; IndicatorShortName("CCI_STD"); SetIndexLabel(0,"CCI_STD"); //======================================================================================== switch(TFA) { case 1 : string TimeFrameStrA="Period_M1"; break; case 5 : TimeFrameStrA="Period_M5"; break; case 15 : TimeFrameStrA="Period_M15"; break; case 30 : TimeFrameStrA="Period_M30"; break; case 60 : TimeFrameStrA="Period_H1"; break; case 240 : TimeFrameStrA="Period_H4"; break; case 1440 : TimeFrameStrA="Period_D1"; break; case 10080 : TimeFrameStrA="Period_W1"; break; case 43200 : TimeFrameStrA="Period_MN1"; break; default : TimeFrameStrA="Current Timeframe"; SetStepTFA_Up(); } //======================================================================================= switch(TFB) { case 1 : string TimeFrameStrB="Period_M1"; break; case 5 : TimeFrameStrB="Period_M5"; break; case 15 : TimeFrameStrB="Period_M15"; break; case 30 : TimeFrameStrB="Period_M30"; break; case 60 : TimeFrameStrB="Period_H1"; break; case 240 : TimeFrameStrB="Period_H4"; break; case 1440 : TimeFrameStrB="Period_D1"; break; case 10080 : TimeFrameStrB="Period_W1"; break; case 43200 : TimeFrameStrB="Period_MN1"; break; default : TimeFrameStrB="Current Timeframe"; SetStepTFB_Up(); } //======================================================================================= switch(TFC) { case 1 : string TimeFrameStrC="Period_M1"; break; case 5 : TimeFrameStrC="Period_M5"; break; case 15 : TimeFrameStrC="Period_M15"; break; case 30 : TimeFrameStrC="Period_M30"; break; case 60 : TimeFrameStrC="Period_H1"; break; case 240 : TimeFrameStrC="Period_H4"; break; case 1440 : TimeFrameStrC="Period_D1"; break; case 10080 : TimeFrameStrC="Period_W1"; break; case 43200 : TimeFrameStrC="Period_MN1"; break; default : TimeFrameStrC="Current Timeframe"; SetStepTFC_Up(); } //======================================================================================= switch(TFD) { case 1 : string TimeFrameStrD="Period_M1"; break; case 5 : TimeFrameStrD="Period_M5"; break; case 15 : TimeFrameStrD="Period_M15"; break; case 30 : TimeFrameStrD="Period_M30"; break; case 60 : TimeFrameStrD="Period_H1"; break; case 240 : TimeFrameStrD="Period_H4"; break; case 1440 : TimeFrameStrD="Period_D1"; break; case 10080 : TimeFrameStrD="Period_W1"; break; case 43200 : TimeFrameStrD="Period_MN1"; break; default : TimeFrameStrD="Current Timeframe"; SetStepTFD_Up(); } //======================================================================================= } return(0); //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ int deinit() { Refresh(); return(0); } //+--------------------------------------------------------------------------------------+ int start() { Refresh(); datetime TimeArray[]; datetime TimeArray1[]; datetime TimeArray2[];datetime TimeArray3[]; double CCIAm_cci50,CCIAm_cci15; double CCIBm_cci50,CCIBm_cci15; double CCICm_cci50,CCICm_cci15; double CCIDm_cci50,CCIDm_cci15; int CCIAL=0,CCIAS=0, CCIBL=0,CCIBS=0, CCICL=0,CCICS=0, CCIDL=0,CCIDS=0 ; int i,limit,counted_bars=IndicatorCounted(); int y=0,y1=0,y2=0,y3=0; ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TFA); ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TFB); ArrayCopySeries(TimeArray2,MODE_TIME,Symbol(),TFC); ArrayCopySeries(TimeArray3,MODE_TIME,Symbol(),TFD); limit=Bars-counted_bars; //============================================================================================== SetIndexDrawBegin(0,Bars-CountBars); SetIndexDrawBegin(1,Bars-CountBars); SetIndexDrawBegin(2,Bars-CountBars); SetIndexDrawBegin(3,Bars-CountBars); SetIndexDrawBegin(4,Bars-CountBars); SetIndexDrawBegin(5,Bars-CountBars); SetIndexDrawBegin(6,Bars-CountBars); SetIndexDrawBegin(7,Bars-CountBars); // ------------------ laat laaste 2 kerse repaint(smooth)-------------------------------- // if(counted_bars>0) limit++; else if (limit>100) limit=CountBars; //====================== CHANGE PERIOD =========================================================== switch(Period()) { case 1: CCIAL = CCI50_1M; CCIAS = CCI15_1M; CCIBL = CCI50_5M; CCIBS = CCI15_5M; CCICL = CCI50_15M; CCIDL = CCI15_15M; CCIDL = CCI50_30M; CCIDS = CCI15_30M ; break; case 5: CCIAL = CCI50_5M; CCIAS = CCI15_5M; CCIBL = CCI50_15M; CCIBS = CCI15_15M; CCICL = CCI50_30M; CCICS = CCI15_30M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; case 15: CCIAL = CCI50_15M; CCIAS = CCI15_15M; CCIBL = CCI50_30M; CCIBS = CCI15_30M; CCICL = CCI50_60M; CCICS = CCI15_60M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; case 30: CCIAL = CCI50_30M; CCIAS = CCI15_30M; CCIBL = CCI50_60M; CCIBS = CCI15_60M; CCICL = CCI50_60M; CCICS = CCI15_60M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; case 60: CCIAL = CCI50_60M; CCIAS = CCI15_60M; CCIBL = CCI50_60M; CCIBS = CCI15_60M; CCICL = CCI50_60M; CCICS = CCI15_60M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; case 240: CCIAL = CCI50_60M; CCIAS = CCI15_60M; CCIBL = CCI50_60M; CCIBS = CCI15_60M; CCICL = CCI50_60M; CCICS = CCI15_60M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; case 1440: CCIAL = CCI50_60M; CCIAS = CCI15_60M; CCIBL = CCI50_60M; CCIBS = CCI15_60M; CCICL = CCI50_60M; CCICS = CCI15_60M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; case 10080:CCIAL = CCI50_60M; CCIAS = CCI15_60M; CCIBL = CCI50_60M; CCIBS = CCI15_60M; CCICL = CCI50_60M; CCICS = CCI15_60M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; case 43150:CCIAL = CCI50_60M; CCIAS = CCI15_60M; CCIBL = CCI50_60M; CCIBS = CCI15_60M; CCICL = CCI50_60M; CCICS = CCI15_60M; CCIDL = CCI50_60M; CCIDS = CCI15_60M ; break; } //==================================================================================================== for(i=0,y=0;i<limit;i++) { if (Time[i]<TimeArray[y]) y++; if (Time[i]<TimeArray1[y1]) y1++; if (Time[i]<TimeArray2[y2]) y2++; if (Time[i]<TimeArray3[y3]) y3++; //======================= HEADINGE ============================================================= { ObjectCreate("HEAD_ZZZ_SMD", OBJ_LABEL,WindowFind("CCI_STD"), 0, 0); ObjectSetText("HEAD_ZZZ_SMD", "CCI-STD_STF" , 8, "Tahoma Narrow", Gold); ObjectSet("HEAD_ZZZ_SMD", OBJPROP_CORNER, 1); ObjectSet("HEAD_ZZZ_SMD", OBJPROP_XDISTANCE, 20); ObjectSet("HEAD_ZZZ_SMD", OBJPROP_YDISTANCE, 5 ); } //===================== RSI A ======================================================================== CCIAm_cci50 = iCCI(NULL, TFA, CCIAL,PRICE_TYPICAL, y ); // CCIAm_cci15 = iCCI(NULL, TFA, CCIAS, PRICE_TYPICAL, y ); if ((CCIAm_cci50 > 0)){ cci50Am_up = 1; cci50Am_dn = 0; } if ((CCIAm_cci50 < 0)){ cci50Am_up = 0; cci50Am_dn = 1; } double totalcci50_UpA = 0.0; double totalcci50_DnA = 0.0; if (( cci50Am_up ) == 1) totalcci50_UpA = 3 ; if (( cci50Am_dn ) == 1) totalcci50_DnA = 3 ; ExtMapBuffer1[i] = 0; ExtMapBuffer2[i] = 0; if ( totalcci50_UpA == 3 || totalcci50_DnA == 3 ){ ExtMapBuffer1[i] = totalcci50_UpA; ExtMapBuffer2[i] = totalcci50_DnA; } //===================================B MIN============================================ // CCIBm_cci50 = iCCI(NULL, TFB, CCIBL, PRICE_TYPICAL, y1 ); CCIAm_cci15 = iCCI(NULL, TFA, CCIAS, PRICE_TYPICAL, y ) ; if ((CCIAm_cci15 > 0)){ cci15Am_up = 1; cci15Am_dn = 0; } if ((CCIAm_cci15 < 0)){ cci15Am_up = 0; cci15Am_dn = 1; } double totalcci15_UpA = 0.0; double totalcci15_DnA = 0.0; if (( cci15Am_up ) == 1) totalcci15_UpA = 4 ; if (( cci15Am_dn ) == 1) totalcci15_DnA = 4 ; ExtMapBuffer3[i] = 0; ExtMapBuffer4[i] = 0; if ( totalcci15_UpA == 4 || totalcci15_DnA == 4 ){ ExtMapBuffer3[i] = totalcci15_UpA; ExtMapBuffer4[i] = totalcci15_DnA; } //======================================C MIN========================================== CCIBm_cci50 = iCCI(NULL, TFB, CCIBL,PRICE_TYPICAL, y1 ) ; // CCICm_cci15 = iCCI(NULL, TFC, CCICS, PRICE_TYPICAL,y2 ) ; if ((CCIBm_cci50 > 0 )){ cci50Bm_up = 1; cci50Bm_dn = 0; } if ((CCIBm_cci50 < 0)){ cci50Bm_up = 0; cci50Bm_dn = 1; } double totalcci50_UpB = 0.0; double totalcci50_DnB = 0.0; if (( cci50Bm_up ) == 1) totalcci50_UpB = 1 ; if (( cci50Bm_dn ) == 1) totalcci50_DnB = 1 ; ExtMapBuffer5[i] = 0; ExtMapBuffer6[i] = 0; if ( totalcci50_UpB == 1 || totalcci50_DnB == 1 ){ ExtMapBuffer5[i] = totalcci50_UpB; ExtMapBuffer6[i] = totalcci50_DnB; } //=====================================D MIN=========================================== // CCIDm_cci50 = iCCI(NULL, TFD, CCIDL, PRICE_TYPICAL,y3); CCIBm_cci15 = iCCI(NULL, TFB, CCIBS, PRICE_TYPICAL,y1); if ((CCIBm_cci15 > 0)){ cci15Bm_up = 1; cci15Bm_dn = 0; } if ((CCIBm_cci15 < 0)){ cci15Bm_up = 0; cci15Bm_dn = 1; } double totalcci15_UpB = 0.0; double totalcci15_DnB = 0.0; if (( cci15Bm_up ) == 1) totalcci15_UpB = 2 ; if (( cci15Bm_dn ) == 1) totalcci15_DnB = 2 ; ExtMapBuffer7[i] = 0; ExtMapBuffer8[i] = 0; if ( totalcci15_UpB == 2 || totalcci15_DnB == 2 ){ ExtMapBuffer7[i] = totalcci15_UpB ; ExtMapBuffer8[i] = totalcci15_DnB; } //===================================================================================== } return(0); } //================================================================================== ++ void SetValuesA(int pA) { TFA = pA; } void SetStepTFA_Up() { switch (Period() ) { case PERIOD_M1 : SetValuesA(PERIOD_M1); break; case PERIOD_M5 : SetValuesA(PERIOD_M5); break; case PERIOD_M15 : SetValuesA(PERIOD_M15); break; case PERIOD_M30 : SetValuesA(PERIOD_M30); break; case PERIOD_H1 : SetValuesA(PERIOD_H1); break; case PERIOD_H4 : SetValuesA(PERIOD_H4); break; case PERIOD_D1 : SetValuesA(PERIOD_D1); break; case PERIOD_W1 : SetValuesA(PERIOD_W1); break; case PERIOD_MN1 : SetValuesA(PERIOD_MN1); break; } } //==============================step timeframe up TF1==================================== void SetValuesB(int pB) { TFB = pB; } void SetStepTFB_Up() { switch (Period() ) { case PERIOD_M1 : SetValuesB(PERIOD_M5); break; case PERIOD_M5 : SetValuesB(PERIOD_M15); break; case PERIOD_M15 : SetValuesB(PERIOD_M30); break; case PERIOD_M30 : SetValuesB(PERIOD_H1); break; case PERIOD_H1 : SetValuesB(PERIOD_H4); break; case PERIOD_H4 : SetValuesB(PERIOD_D1); break; case PERIOD_D1 : SetValuesB(PERIOD_W1); break; case PERIOD_W1 : SetValuesB(PERIOD_MN1); break; case PERIOD_MN1 : SetValuesB(PERIOD_MN1); break; } } //============================== TF2 =================================================== void SetValuesC(int pC) { TFC = pC; } void SetStepTFC_Up() { switch (Period() ) { case PERIOD_M1 : SetValuesC(PERIOD_M15); break; case PERIOD_M5 : SetValuesC(PERIOD_M30); break; case PERIOD_M15 : SetValuesC(PERIOD_H1); break; case PERIOD_M30 : SetValuesC(PERIOD_H4); break; case PERIOD_H1 : SetValuesC(PERIOD_D1); break; case PERIOD_H4 : SetValuesC(PERIOD_W1); break; case PERIOD_D1 : SetValuesC(PERIOD_MN1); break; case PERIOD_W1 : SetValuesC(PERIOD_MN1); break; case PERIOD_MN1 : SetValuesC(PERIOD_MN1); break; } } //=============================== TF3 ================================================== void SetValuesD(int pD) { TFD = pD; } void SetStepTFD_Up() { switch (Period() ) { case PERIOD_M1 : SetValuesD(PERIOD_M30); break; case PERIOD_M5 : SetValuesD(PERIOD_H1); break; case PERIOD_M15 : SetValuesD(PERIOD_H4); break; case PERIOD_M30 : SetValuesD(PERIOD_D1); break; case PERIOD_H1 : SetValuesD(PERIOD_W1); break; case PERIOD_H4 : SetValuesD(PERIOD_MN1); break; case PERIOD_D1 : SetValuesD(PERIOD_MN1); break; case PERIOD_W1 : SetValuesD(PERIOD_MN1); break; case PERIOD_MN1 : SetValuesD(PERIOD_MN1); break; } } //================================================================================== //==================================================================== void Refresh() { ObjectDelete("HEAD_ZZZ_SMD"); } //------------------------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Indicators Used:
Commodity channel index
Custom Indicators Used:
Order Management characteristics:
Other Features: