//+------------------------------------------------------------------+ //| VSA_YJZ.mq4 | //| Copyright © 2009, yijomza@gmail.com | //| yijomza@gmail.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, yijomza@gmail.com." #property link "yijomza@gmail.com" #property indicator_chart_window #define UP_ARROW_1 0 #define DOWN_ARROW_1 1 #define UP_ARROW_2 2 #define DOWN_ARROW_2 3 int CountBars=100; int Corner=1; string separator1 = " "; int barOffset =1; //----Input //---- buffers int c=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- static int oldBars=0; int counted_bars=IndicatorCounted(); bool isBuy,isSell; if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit=MathMin(Bars-counted_bars,Bars-1); if(oldBars!=Bars) //for(c=1000;c>=0;c--) for(int i=0; i < (int) limit; c++) { /* double upArrow1 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator",100,1,16777184,8421504,8421504,16748574,255,0,0,16777215,true,false,false,true,0,16776960,65535,65280,255,1,0,0,0,0); double downArrow1 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator",100,1,16777184,8421504,8421504,16748574,255,0,0,16777215,true,false,false,true,0,16776960,65535,65280,255,0,1,0,0,0); double upArrow2 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator",100,1,16777184,8421504,8421504,16748574,255,0,0,16777215,true,false,false,true,0,16776960,65535,65280,255,0,0,1,0,0); double downArrow2 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator",100,1,16777184,8421504,8421504,16748574,255,0,0,16777215,true,false,false,true,0,16776960,65535,65280,255,0,0,0,1,0); double upArrow1 = iCustom(NULL, NULL, "Trade-Confirmed-Indicator", countBars, corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, false, false, false, UP_ARROW_1, barOffset); double downArrow1 = iCustom(NULL, NULL, "Trade-Confirmed-Indicator", countBars, corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, false, false, false, DOWN_ARROW_1, barOffset); double upArrow2 = iCustom(NULL, NULL, "Trade-Confirmed-Indicator", countBars, corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, false, false, false, UP_ARROW_2, barOffset); double downArrow2 = iCustom(NULL, NULL, "Trade-Confirmed-Indicator", countBars, corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, false, false, false, DOWN_ARROW_2, barOffset); */ double upArrow1 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator", CountBars, Corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, 1,4, barOffset); double downArrow1 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator", CountBars, Corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, 2,4, barOffset) ; double upArrow2 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator", CountBars, Corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, 3,4, barOffset); double downArrow2 = iCustom(NULL, PERIOD_CURRENT, "Trade-Confirmed-Indicator", CountBars, Corner, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, clrNONE, separator1, false, 4,4, barOffset) ; /* Trade-Confirmed-Indicator parameters: CountBars=100 Corner=1 BGcolor=16777184 NeutralBarClr=8421504 BuyBarClr=16748574 SellBarClr=255 TextClr=0 PercentClr=16777215 c50=--------------- Notifications -------------- alertsMessage=true alertsNotify=false alertsEmail=false alertsSound=true c51=------------- Arrows Settings -------------- upArrowColor1=16776960 dnArrowColor1=65535 upArrowColor2=65280 dnArrowColor2=255 */ double lossArrow = 0;//1; double itfm = iCustom(NULL, PERIOD_CURRENT, "itmf_sigalert",14,5,0.618,0,1,1); double trend_up = iCustom(NULL, 0, "pzlopeztrend", 0, 1,1); double trend_down = iCustom(NULL, 0, "pzlopeztrend", 1, 1,1); if(upArrow1 || downArrow1 || upArrow2 || downArrow2 ||itfm ||trend_up ||trend_down ) { if(upArrow1) Print("upArrow1 = "+upArrow1); if(downArrow1) Print("downArrow1 = "+downArrow1); if(upArrow2) Print("upArrow2 = "+upArrow2); if(downArrow2) Print("downArrow2 = "+downArrow2); if(itfm) Print("itfm = "+itfm); if(trend_up) Print("trend_up = "+trend_up); if(trend_down) Print("trend_down = "+trend_down); } return(!GetLastError()); if( trend_up && ( itfm >0 ) && upArrow1<=0 && upArrow2<0 ) isBuy= true; if( trend_down && ( itfm >0 ) && upArrow1<=0 && upArrow2<0 ) isSell=true; //itfm[1]*0.05 < itfm[0] || } Comment("Decision: isBuy",isBuy , "isSell ",isSell); }