[MT4指标]FOZZY每日指示灯
主图指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
使用RSI指标来计算每日的价格指示指标
//+------------------------------------------------------------------+
//| Fozzy Daily Indicator |
//| Programmed by Aidrian O\'Connor |
//| http://www.unitone.org |
//+------------------------------------------------------------------+
#property copyright \"Fozzy\"
#property link \"http://\"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Aqua
#property indicator_color2 Red
#property indicator_color3 MediumSeaGreen
#property indicator_color4 MediumSeaGreen
#property indicator_color5 MediumSeaGreen
//---- indicator parameters
extern int RSIPeriod = 9;
extern int RSIMAPeriod = 8;
extern int BandsPeriod=40;
extern int BandsShift=0;
extern double BandsDeviations=2.0;
//---- buffers
double RSI;
double RSIMA;
double BBMid;
double BBUp;
double BBDn;
int i;
int init()
{
IndicatorBuffers(5);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,i-1);
SetIndexBuffer(0, RSI);
SetIndexLabel(0,\"RSI\");
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,i-1);
SetIndexBuffer(1, RSIMA);
SetIndexLabel(1,\"RSI-MA\");
SetIndexStyle(2,DRAW_LINE,STYLE_DOT,0,MediumSeaGreen);
SetIndexDrawBegin(2,i-1);
SetIndexBuffer(2, BBMid);
SetIndexLabel(2,\"BB-Mid\");
SetIndexStyle(3,DRAW_LINE,STYLE_DOT,0,MediumSeaGreen);
SetIndexDrawBegin(3,i-1);
SetIndexBuffer(3, BBUp);
SetIndexLabel(3,\"BB-Up\");
SetIndexStyle(4,DRAW_LINE,STYLE_DOT,0,MediumSeaGreen);
SetIndexDrawBegin(4,i-1);
SetIndexBuffer(4, BBDn);
SetIndexLabel(4,\"BB-Dn\");
return(0);
}
//--------------- Alert Code ---------------\\\\
bool Crossed (double line1 , double line2 )
{
static string last_direction = \"\";
string current_direction = \"\";
if(line1>line2)current_direction = \"up\";
if(line1<=line2)current_direction = \"down\";
if(current_direction != last_direction)
{
Alert(\"Fozzy Cross for \"+Symbol()+\" on the \"+Period()+\" minute chart.\");
last_direction = current_direction;
return (true);
}
else
{
return (false);
}
}
//------------------------------------------\\\\
int start()
{
i=Bars-BandsPeriod;
while(i>=0) {
RSI = iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,i);
i--;
}
i=Bars-BandsPeriod;
while(i>=0) {
RSIMA = iMAOnArray(RSI,0,RSIMAPeriod,0,MODE_SMA,i);
i--;
}
i=Bars-BandsPeriod;
while(i>=0) {
BBMid = iMAOnArray(RSIMA,0,BandsPeriod,BandsShift,MODE_SMA,i);
BBUp = iBandsOnArray(RSIMA,0,BandsPeriod,BandsDeviations,BandsShift,MODE_UPPER,i);
BBDn = iBandsOnArray(RSIMA,0,BandsPeriod,BandsDeviations,BandsShift,MODE_LOWER,i);
i--;
}
Print(Crossed (RSI[0],RSIMA[0]));
return(0);
}
//+------------------------------------------------------------------+
发表于:2017-08-11 08:09只看该作者
2楼
谢谢分享!!
韬客社区www.talkfx.co