[MT4指标]趋势买卖点指标
主图指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| JJN-Nugget.mq4 |
//| Copyright ? 2012, JJ Newark |
//| http:/jjnewark.atw.hu |
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2012, JJ Newark"
#property link "http:/jjnewark.atw.hu"
//---- indicator settings
//#property indicator_separate_window
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DarkOrange
#property indicator_width1 2
//---- indicator parameters
extern string __Copyright__ = "http://jjnewark.atw.hu";
extern color BuyColor = YellowGreen;
extern color SellColor = OrangeRed;
extern color FontColor = Black;
extern int DisplayDecimals = 4;
extern int PosX = 10;
extern int PosY = 20;
//---- indicator buffers
double MainVal;
double ValSum;
double Vals[8];
double ValSumTemp;
int per={5,8,13,21,34,55,89,144};
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_SECTION);
SetIndexBuffer(0,MainVal);
SetIndexBuffer(1,ValSum);
SetIndexLabel(0,"MainVal");
ObjectCreate("NuggetIndName",OBJ_LABEL,0,0,0,0,0);
ObjectSet("NuggetIndName",OBJPROP_CORNER,0);
ObjectSet("NuggetIndName",OBJPROP_XDISTANCE,PosX+12);
ObjectSet("NuggetIndName",OBJPROP_YDISTANCE,PosY);
ObjectSetText("NuggetIndName","JJN-Nugget",8,"Lucida Sans Unicode",FontColor);
ObjectCreate("NuggetLine0",OBJ_LABEL,0,0,0,0,0);
ObjectSet("NuggetLine0",OBJPROP_CORNER,0);
ObjectSet("NuggetLine0",OBJPROP_XDISTANCE,PosX+5);
ObjectSet("NuggetLine0",OBJPROP_YDISTANCE,PosY+8);
ObjectSetText("NuggetLine0","------------------",8,"Tahoma",FontColor);
ObjectCreate("NuggetLine1",OBJ_LABEL,0,0,0,0,0);
ObjectSet("NuggetLine1",OBJPROP_CORNER,0);
ObjectSet("NuggetLine1",OBJPROP_XDISTANCE,PosX+5);
ObjectSet("NuggetLine1",OBJPROP_YDISTANCE,PosY+10);
ObjectSetText("NuggetLine1","------------------",8,"Tahoma",FontColor);
ObjectCreate("NuggetDirection",OBJ_LABEL,0,0,0,0,0);
ObjectSet("NuggetDirection",OBJPROP_CORNER,0);
ObjectSet("NuggetDirection",OBJPROP_XDISTANCE,PosX);
ObjectSet("NuggetDirection",OBJPROP_YDISTANCE,PosY+12);
ObjectSetText("NuggetDirection","Wait ...",28,"Lucida Sans Unicode",FontColor);
ObjectCreate("NuggetLevel",OBJ_LABEL,0,0,0,0,0);
ObjectSet("NuggetLevel",OBJPROP_CORNER,0);
ObjectSet("NuggetLevel",OBJPROP_XDISTANCE,PosX);
ObjectSet("NuggetLevel",OBJPROP_YDISTANCE,PosY+50);
ObjectSetText("NuggetLevel"," ----- ",9,"Lucida Sans Unicode",FontColor);
//----
IndicatorShortName("JJN-Nugget");
//---- initialization done
return(0);
}
int deinit()
{
//----
ObjectDelete("NuggetLine0");
ObjectDelete("NuggetLine1");
ObjectDelete("NuggetIndName");
ObjectDelete("NuggetDirection");
ObjectDelete("NuggetLevel");
//----
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i=0; i(High+Low)/2 && ValSum[i+1]<(High[i+1]+Low[i+1])/2)
{
MainVal=High;
}
else if(ValSum<(High+Low)/2 && ValSum[i+1]>(High[i+1]+Low[i+1])/2)
{
MainVal=Low;
}
else MainVal=EMPTY_VALUE;
}
double lastprice=0;
int found=0;
int w=0;
while(found<1)
{
if(MainVal[w]!=EMPTY_VALUE)
{
lastprice=MainVal[w];
found++;
}
w++;
}
if(ValSum[0]<(High[0]+Low[0])/2)
{
ObjectSet("NuggetDirection",OBJPROP_XDISTANCE,PosX+5);
ObjectSetText("NuggetDirection","BUY",28,"Lucida Sans Unicode",BuyColor);
ObjectSetText("NuggetLevel","above "+DoubleToStr(lastprice,DisplayDecimals),9,"Lucida Sans Unicode",BuyColor);
}
else if(ValSum[0]>(High[0]+Low[0])/2)
{
ObjectSet("NuggetDirection",OBJPROP_XDISTANCE,PosX+2);
ObjectSetText("NuggetDirection","SELL",28,"Lucida Sans Unicode",SellColor);
ObjectSetText("NuggetLevel","under "+DoubleToStr(lastprice,DisplayDecimals),9,"Lucida Sans Unicode",SellColor);
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
JJN-Nugget.jpg

发表于:2014-06-08 08:41只看该作者
2楼
楼主高人啊,我先收藏了
韬客社区www.talkfx.co
发表于:2014-06-08 09:10只看该作者
3楼
怎么用啊?
韬客社区www.talkfx.co
发表于:2016-06-23 08:02只看该作者
4楼
指标很灵敏,指示性也很强
韬客社区www.talkfx.co