[MT4指标]ADX长期交叉指标
主图指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| ADX Crossing.mq4
//| Amir
//+------------------------------------------------------------------+
#property copyright "Author - Amir"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
//---- input parameters
extern int Ma_Period=220;
extern double Cross_Over_Threshold=0.00003;
extern int CountBars=5000;
//---- buffers
double val1;
double val2;
double Ma0,Ma1,Ma2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,108);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,108);
SetIndexBuffer(0,val1);
SetIndexBuffer(1,val2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2 |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars);
SetIndexDrawBegin(1,Bars-CountBars);
int i,shift,counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0;
for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0;
}
for (shift = CountBars; shift>=0; shift--)
{
Ma0=iMA(Symbol(),Period(),Ma_Period, 0, MODE_SMA, PRICE_MEDIAN,shift );
Ma1=iMA(Symbol(),Period(),Ma_Period, 0, MODE_SMA, PRICE_MEDIAN,shift+1);
Ma2=iMA(Symbol(),Period(),Ma_Period, 0, MODE_SMA, PRICE_MEDIAN,shift+2);
if (( MathAbs(Ma0-Ma1)>Cross_Over_Threshold) && Ma0>Ma1 && Ma1>Ma2)
{
val1[shift]=Ma0;
}
if (( MathAbs(Ma0-Ma1)>Cross_Over_Threshold) && Ma0Ind-TRWscalper.jpg
发表于:2017-08-11 09:34只看该作者
2楼
阅尽天下指标
韬客社区www.talkfx.co
发表于:2017-08-30 15:59只看该作者
3楼
好东东,谢谢分分享
韬客社区www.talkfx.co
发表于:2017-09-07 00:31只看该作者
4楼
厉害了
韬客社区www.talkfx.co