Support and Resistance Breakout Arrows【支撑阻力突破箭头】
//+------------------------------------------------------------------+
//| Support and Resistance|
//| Copyright ?2004 Barry Stander|
//| Arrows added by Lennoi Anderson, 2015|
//+------------------------------------------------------------------+
#property copyright "Copyright ?2004 Barry Stander; Arrow alerts by Lennoi Anderson, 2015."
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Magenta
#property indicator_width3 2
#property indicator_width4 2
extern bool RSICCI_Filter = FALSE;
extern double RSIPeriod = 14;
extern double RSIOverbought = 75;
extern double RSIOversold = 25;
extern double CCIPeriod = 14;
extern double CCIBuyLevel = 50;
extern double CCISellLevel = -50;
extern int SignalDots = 3;
extern bool Alerts = TRUE;
extern bool ApplyToClose = TRUE;
extern int BarCount = 10000;
bool HighBreakout = FALSE;
bool HighBreakPending = FALSE;
bool LowBreakout = FALSE;
bool LowBreakPending = FALSE;
double LastResistance = 0;
double LastSupport = 0;
double AlertBar = 0;
//---- buffers
double v1[];
double v2[];
double BreakUp[];
double BreakDown[];
double val1;
double val2;
int counter1;
int counter2;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexArrow(0, 119);
SetIndexArrow(1, 119);
//----
SetIndexStyle(0, DRAW_ARROW, STYLE_DOT, 0, Red);
//SetIndexDrawBegin(0, i-1);
SetIndexBuffer(0, v1);
SetIndexLabel(0, "Resistance");
//----
SetIndexStyle(1, DRAW_ARROW, STYLE_DOT, 0, Blue);
//SetIndexDrawBegin(1, i-1);
SetIndexBuffer(1, v2);
SetIndexLabel(1, "Support");
//----
SetIndexStyle(2, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(2, 233);
SetIndexBuffer(2, BreakUp);
//----
SetIndexStyle(3, DRAW_ARROW, EMPTY, 2);
SetIndexArrow(3, 234);
SetIndexBuffer(3, BreakDown);
return(0);
}
//+------------------------------------------------------------------+
int start()
{
//----
for(int i = BarCount; i >=0; i--)
{
val1 = iFractals(NULL, 0, MODE_UPPER, i);
//----
if(val1 > 0)
{
v1 = High;
counter1 = 1;
}
else
{
v1 = v1;
counter1++;
}
val2 = iFractals(NULL, 0, MODE_LOWER, i);
//----
if(val2 > 0)
{
v2 = Low;
counter2 = 1;
}
else
{
v2 = v2;
counter2++;
}
if (v1 != LastResistance) { HighBreakPending = True; LastResistance = v1; }
if (v2 != LastSupport) { LowBreakPending = True; LastSupport = v2; }
if (HighBreakPending && Close > v1 && (!RSICCI_Filter || (RSICCI_Filter && iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i) < RSIOverbought &&
iCCI(Symbol(), NULL, CCIPeriod, PRICE_CLOSE, i) > CCIBuyLevel)) && counter1 >= SignalDots) HighBreakout = TRUE;
if (LowBreakPending && Close < v2 && (!RSICCI_Filter || (RSICCI_Filter && iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, i) > RSIOversold &&
iCCI(Symbol(), NULL, CCIPeriod, PRICE_CLOSE, i) < CCISellLevel)) && counter2 >= SignalDots) LowBreakout = TRUE;
if (ApplyToClose) int AlertCandle = 1; else AlertCandle = 0;
if (HighBreakout)
{
if (i >= AlertCandle) BreakUp = Low-10*Point;
if (Alerts && i == AlertCandle && Bars > AlertBar)
{
Alert(Symbol(), " M", Period(), ": Resistance Breakout: BUY");
AlertBar = Bars;
}
HighBreakout = False;
HighBreakPending = False;
} else
if (LowBreakout)
{
if (i >= AlertCandle) BreakDown = High+10*Point;
if (Alerts && i==AlertCandle && Bars>AlertBar)
{
Alert(Symbol(), " M", Period(), ": Support Breakout: SELL");
AlertBar = Bars;
}
LowBreakout = False;
LowBreakPending = False;
}
}
return(0);
}
感谢分享 前排支持下分享 学习技术交流技术 学习技术交流技术 感谢分享666 真是 收益 匪浅 看帖回帖是美德!:lol 学习了,不错 支持下
页:
[1]
2