BuySellIndicators.mq4f.guig le 12/11/2009, 12:23 am//| BuySellIndicators.mq4 |//| Copyright 2005, Eli Hayun |#property copyright "Copyright 2005, Eli Hayun"double dUpRviBuffer[];double dDownRviBuffer[];double dUpMacdBuffer[];double dDownMacdBuffer[];double dUpBothBuffer[];double dDownBothBuffer[];SetIndexBuffer(0,dUpRviBuffer);SetIndexBuffer(1,dDownRviBuffer);SetIndexBuffer(2,dUpMacdBuffer);SetIndexBuffer(3,dDownMacdBuffer);SetIndexBuffer(4,dUpBothBuffer);SetIndexBuffer(5,dDownBothBuffer);SetIndexArrow(2,241);SetIndexArrow(3,242);SetIndexArrow(4,252);SetIndexArrow(5,252);SetIndexLabel(0,"Rvi Buy");SetIndexLabel(1,"Rvi Sell");SetIndexLabel(2,"Macd Buy");SetIndexLabel(3,"Macd Sell");SetIndexLabel(4,"Strong Buy");SetIndexLabel(5,"Strong Sell");nBars=Bars-nCountedBars-3;nBars=Bars-nCountedBars-1;for (int ii=0; iidUpMacdBuffer[ii]=0;dDownMacdBuffer[ii] = 0;dUpRviBuffer[ii]=0;dDownRviBuffer[ii] = 0;dUpBothBuffer[ii] = 0;dDownBothBuffer[ii] = 0;// Check if RVI has been changeddouble val0=iRVI(NULL, 0, 10,MODE_MAIN,ii);double sig0=iRVI(NULL, 0, 10,MODE_SIGNAL,ii);double val1=iRVI(NULL, 0, 10,MODE_MAIN,ii+1);double sig1=iRVI(NULL, 0, 10,MODE_SIGNAL,ii+1);if ((val0 > sig0) && (val1 < sig1))dUpRviBuffer[ii] = Low[ii] - 2 * MarketInfo(Symbol(),MODE_POINT);if ((val0 < sig0) && (val1 > sig1))dDownRviBuffer[ii] = High[ii] + 2 * MarketInfo(Symbol(),MODE_POINT);// Check if MACD has been changeddouble valm0=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,ii);double sigm0=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,ii);double valm1=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,ii+1);double sigm1=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,ii+1);if ((valm0 > sigm0) && (valm1 < sigm1))dUpMacdBuffer[ii] = Low[ii] - 0.0004;if ((valm0 < sigm0) && (valm1 > sigm1))dDownMacdBuffer[ii] = High[ii] + 2 * MarketInfo(Symbol(),MODE_POINT);if ((dUpRviBuffer[ii] != 0) && (dUpMacdBuffer[ii]))dUpMacdBuffer[ii] = 0;dUpRviBuffer[ii] = 0;dUpBothBuffer[ii] = Low[ii] - 2 * MarketInfo(Symbol(),MODE_POINT);if ((Period() >= 60) && (ii == 0))Print("Buy alert");if ((dDownRviBuffer[ii] != 0) && (dDownMacdBuffer[ii]))dDownBothBuffer[ii] = High[ii] + 2 * MarketInfo(Symbol(),MODE_POINT);Print("Sell alert");
