Indicator needs to reference Bollinger Bands
I have this indicator, however, I need it to reference the Bollinger Bands. I need it to include reference to at or near the Bollinger and inside candle. Would like to reference Stochastics overbought/oversold. Any ideas.
///------------------------------------------------------------------+
//| MS IPP2 v2 3/6/09 |
//| MarketSlayer |
// +------------------------------------------------------------------+
#property indicator_chart_window
//---- input parameters
extern int barsToProcess=1000;
// +------------------------------------------------------------------+
//| Custom indicator initialization function |
// +------------------------------------------------------------------+
int init ()
{
//---- indicators
//----
return (0);
}
// +------------------------------------------------------------------+
//| Custom indicator deinitialization function |
// +------------------------------------------------------------------+
int deinit ()
{
//----
int i;
for (i=0; i< Bars; i++)
{
ObjectDelete ("Bearish IPP2" +DoubleToStr (i, 0));
ObjectDelete ("Bullish IPP2" +DoubleToStr (i, 0));
}
//----
return (0);
}
// +------------------------------------------------------------------+
//| Custom indicator iteration function |
// +------------------------------------------------------------------+
int start ()
{
int counted_bars=IndicatorCounted (),
//----
limit,
i=0;
if (counted_bars> 0)
counted_bars--;
limit=Bars-counted_bars;
if (limit> barsToProcess)
limit=barsToProcess;
while (i< limit)
{
// BEARISH IPP#2
// Candle[1] is at or near Top Bollinger Band
// Candle[2] is inside Candle[1]
if ((Close [ i+2] > Open [ i+2]) && (Close [ i+1]> Open [i+1]) && (Open [i]> Close [ i+1])
&& (High [i]< High [ i+1])&& (Low [i]> Low [ i+1]))
{
ObjectCreate ("Bearish IPP2" +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], High [i] + 50*Point);
ObjectSet ("Bearish IPP2" +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 130);
ObjectSet ("Bearish IPP2" +DoubleToStr (i, 0), OBJPROP_COLOR, Red );
Alert("Bearish IPP2 -SHORT @", Low[i]);
}
// Bullish IPP#2
if ((Close [ i+2] < Open [ i+2]) && (Close [ i+1]< Open [i+1]) && (Open [i]< Close [ i+1])
&& (High [i]< High [ i+1])&& (Low [i]> Low [ i+1]))
{
ObjectCreate ("Bullish IPP2" +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], Low [i] - 50*Point);
ObjectSet ("Bullish IPP2" +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 130);
ObjectSet ("Bullish IPP2" +DoubleToStr (i, 0), OBJPROP_COLOR, Lime );
Alert("Bullish IPP2 -LONG @", High[i],Time);
// PlaySound("alert.wav");
}
i++;
}
//----
return (0);
}
//+------------------------------------------------------------------+
I have this indicator, however, I need it to reference the Bollinger Bands. I need it to include reference to at or near the Bollinger and inside candle. Would like to reference Stochastics overbought/oversold. Any ideas.
///------------------------------------------------------------------+
//| MS IPP2 v2 3/6/09 |
//| MarketSlayer |
// +------------------------------------------------------------------+
#property indicator_chart_window
//---- input parameters
extern int barsToProcess=1000;
// +------------------------------------------------------------------+
//| Custom indicator initialization function |
// +------------------------------------------------------------------+
int init ()
{
//---- indicators
//----
return (0);
}
// +------------------------------------------------------------------+
//| Custom indicator deinitialization function |
// +------------------------------------------------------------------+
int deinit ()
{
//----
int i;
for (i=0; i< Bars; i++)
{
ObjectDelete ("Bearish IPP2" +DoubleToStr (i, 0));
ObjectDelete ("Bullish IPP2" +DoubleToStr (i, 0));
}
//----
return (0);
}
// +------------------------------------------------------------------+
//| Custom indicator iteration function |
// +------------------------------------------------------------------+
int start ()
{
int counted_bars=IndicatorCounted (),
//----
limit,
i=0;
if (counted_bars> 0)
counted_bars--;
limit=Bars-counted_bars;
if (limit> barsToProcess)
limit=barsToProcess;
while (i< limit)
{
// BEARISH IPP#2
// Candle[1] is at or near Top Bollinger Band
// Candle[2] is inside Candle[1]
if ((Close [ i+2] > Open [ i+2]) && (Close [ i+1]> Open [i+1]) && (Open [i]> Close [ i+1])
&& (High [i]< High [ i+1])&& (Low [i]> Low [ i+1]))
{
ObjectCreate ("Bearish IPP2" +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], High [i] + 50*Point);
ObjectSet ("Bearish IPP2" +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 130);
ObjectSet ("Bearish IPP2" +DoubleToStr (i, 0), OBJPROP_COLOR, Red );
Alert("Bearish IPP2 -SHORT @", Low[i]);
}
// Bullish IPP#2
if ((Close [ i+2] < Open [ i+2]) && (Close [ i+1]< Open [i+1]) && (Open [i]< Close [ i+1])
&& (High [i]< High [ i+1])&& (Low [i]> Low [ i+1]))
{
ObjectCreate ("Bullish IPP2" +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], Low [i] - 50*Point);
ObjectSet ("Bullish IPP2" +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 130);
ObjectSet ("Bullish IPP2" +DoubleToStr (i, 0), OBJPROP_COLOR, Lime );
Alert("Bullish IPP2 -LONG @", High[i],Time);
// PlaySound("alert.wav");
}
i++;
}
//----
return (0);
}
//+------------------------------------------------------------------+