[MT4指标]趋势跟踪指标
主图指标,趋势跟踪指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| CheckPower.mq4 |
//| Copyright 2013, [email protected] |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright \"Copyright 2013, [email protected]\"
#property link \"http://www.metaquotes.net\"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Aqua
#property indicator_color2 FireBrick
#property indicator_color3 Aqua
#property indicator_color4 Yellow
#property indicator_width1 0
#property indicator_width2 0
#property indicator_width3 0
#property indicator_width4 0
double Bulls;
double Bears;
double LongEntry;
double ShortEntry;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_NONE);
SetIndexStyle(1,DRAW_NONE);
SetIndexStyle(2,DRAW_ARROW);
SetIndexStyle(3,DRAW_ARROW);
SetIndexBuffer(0,Bulls);
SetIndexBuffer(1,Bears);
SetIndexBuffer(2,LongEntry);
SetIndexBuffer(3,ShortEntry);
SetIndexArrow(0,119);
SetIndexArrow(1,119);
SetIndexArrow(2,225);
SetIndexArrow(3,226);
SetIndexLabel(0,\"Bulls\");
SetIndexLabel(1,\"Bears\");
SetIndexLabel(2,\"LongEnt\");
SetIndexLabel(3,\"ShortEnt\");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
limit = Bars-counted_bars;
if(limit<0)limit=0;
//----for
for(int i=limit;i>=1;i--)
{
if(CheckPower(i,\"CheckBuy\"))
{
Bulls=Low;
if(!UpBarCheck(i)) LongEntry[i-1]=Low[i+1];
}
else Bulls=EMPTY_VALUE;
if(CheckPower(i,\"CheckSell\"))
{
Bears=High;
if(UpBarCheck(i)) ShortEntry[i-1]=High[i+1];
}
else Bears=EMPTY_VALUE;
}//end for
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool CheckPower(int i, string mode)
{
double Bull_power =Bullspower(i);
double Bear_power =Bearspower(i);
double Bull_power_LK =Bullspower(i)+Bullspower(i+1);//+Bullspower(i+2)+Bullspower(i+3)+Bullspower(i+4)+Bullspower(i+5);
double Bear_power_LK =Bearspower(i)+Bearspower(i+1);//+Bearspower(i+2)+Bearspower(i+3)+Bearspower(i+4)+Bearspower(i+5);
if(mode==\"CheckBuy\")
{
for(int x=i+1;x<=Bars;x++ )
{
if(Bear_power > Bull_power_LK) {return(true); break;}
else
{
if(Bull_power > Bear_power_LK) {return(false);break;}
else
{
Bull_power=Bull_power+Bullspower(x);
Bear_power =Bear_power+Bearspower(x);
Bull_power_LK=Bull_power_LK+Bullspower(x+1);
Bear_power_LK =Bear_power_LK+Bearspower(x+1);
}
}///else
}//for
}//if
//----
if(mode==\"CheckSell\")
{
for(x=i+1;x<=Bars;x++ )
{
if(Bull_power > Bear_power_LK) {return(true);break;}
else
{
if(Bear_power > Bull_power_LK) {return(false); break;}
else
{
Bull_power=Bull_power+Bullspower(x);
Bear_power =Bear_power+Bearspower(x);
Bull_power_LK=Bull_power_LK+Bullspower(x+1);
Bear_power_LK =Bear_power_LK+Bearspower(x+1);
}
}///else
}//for
}//if
}//if
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Bullspower(int i)
{
double returnbullvalue = MathAbs(iBullsPower(NULL, 0, 1,PRICE_CLOSE,i));
return(returnbullvalue);
}
//----
double Bearspower(int i)
{
double returnbearvalue = MathAbs(iBearsPower(NULL, 0, 1,PRICE_CLOSE,i));
return(returnbearvalue);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
bool UpBarCheck(int i)
{
if(CloseClose[i+1]) return(true);///up bar
if(Close==Close[i+1])
{
if(CloseClose[i+2]) return(true);///up bar
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
发表于:2014-12-21 01:37只看该作者
2楼
谢谢楼主分享,可惜不会导入。
韬客社区www.talkfx.co
发表于:2014-12-31 08:36只看该作者
3楼
谢谢分享
韬客社区www.talkfx.co
发表于:2015-03-12 18:16只看该作者
4楼
谢谢分享
韬客社区www.talkfx.co
发表于:2015-04-07 08:05只看该作者
5楼
谢谢分享
韬客社区www.talkfx.co
发表于:2015-05-26 03:16只看该作者
6楼
看看再说
韬客社区www.talkfx.co
发表于:2016-06-20 00:21只看该作者
7楼
谢谢分享
韬客社区www.talkfx.co
发表于:2017-08-09 00:42只看该作者
8楼
缺钱,灌水赚通宝,谢谢分享!!
韬客社区www.talkfx.co
发表于:2018-04-11 12:58只看该作者
9楼
通宝是个问题
韬客社区www.talkfx.co
发表于:2018-04-24 04:19只看该作者
10楼
为什么我编辑出错呀
韬客社区www.talkfx.co
发表于:2021-01-04 00:23只看该作者
12楼
谢谢分享
韬客社区www.talkfx.co