[MT4指标]K线变色指标2
主图指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| FractalsPaint.mq4 |
//| Copyright ? 2006 [email protected] |
//+------------------------------------------------------------------+
#property copyright \"FxFisherman.com\"
#property link \"http://www.fxfisherman.com\"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
extern int Shift_Bars=0;
int Bars_Count= 0;
//---- buffers
double v1;
double v2;
int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,v1);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,v2);
watermark();
return(0);
}
int start()
{
bool hiFractal;
bool loFractal;
int curFractal;
double price;
int i;
int shift;
int counted_bars = IndicatorCounted();
if (counted_bars > 0) counted_bars--;
if (Bars_Count > 0 && Bars_Count <= Bars)
{
i = Bars_Count - counted_bars;
}else{
i = Bars - counted_bars;
}
while(i>=0)
{
shift = i + Shift_Bars;
// Resistance
price = High[shift+3];
hiFractal = price > High[shift+2] &&
price > High[shift+1];
// Support
price = Low[shift+3];
loFractal = price < Low[shift+2] &&
price < Low[shift+1];
if (hiFractal && !loFractal) {
curFractal = -1;
}else if(loFractal && !hiFractal) {
curFractal = 1;
}else if(loFractal && hiFractal){
curFractal = 0;
}
if (curFractal == 1) {
v2 = High;
v1 = Low;
}else if(curFractal == -1) {
v1 = High;
v2 = Low;
}else{
v1 = Low;
v2 = Low;
}
i--;
}
return(0);
}
//+------------------------------------------------------------------+
void watermark()
{
ObjectCreate(\"fxfisherman\", OBJ_LABEL, 0, 0, 0);
ObjectSetText(\"fxfisherman\", \"fxfisherman.com\", 11, \"Lucida Handwriting\", RoyalBlue);
ObjectSet(\"fxfisherman\", OBJPROP_CORNER, 2);
ObjectSet(\"fxfisherman\", OBJPROP_XDISTANCE, 5);
ObjectSet(\"fxfisherman\", OBJPROP_YDISTANCE, 10);
return(0);
}
发表于:2014-07-15 10:36只看该作者
2楼
灌水升级
发表于:2015-06-22 00:37只看该作者
3楼
非常感谢楼主!
韬客社区www.talkfx.co
发表于:2015-08-28 10:53只看该作者
4楼
谢谢分享
韬客社区www.talkfx.co
发表于:2015-08-28 10:53只看该作者
5楼
谢谢分享
韬客社区www.talkfx.co
发表于:2015-08-29 07:18只看该作者
6楼
jgyjtyjutyu
韬客社区www.talkfx.co