[MT4指标]0_IndInverse指标
趋势跟踪系统
//+------------------------------------------------------------------+
//| IND Inverse.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2006, ..."
#property link "http://www.forex-tsd.com/"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Maroon
#property indicator_color2 Green
#property indicator_color3 Red
//---- input parameters
extern int iPeriod = 1;
extern int cbars = 1000;
//---- buffers
double Buffer;
double SigBuffer;
double DirBuffer;
//----
int last = 0;
//----
//+------------------------------------------------------------------+
//| Init |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorDigits(Digits + 2);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, Buffer);
SetIndexStyle(1, DRAW_ARROW);
SetIndexBuffer(1, SigBuffer);
SetIndexEmptyValue(1, 0);
SetIndexArrow(1, 233);
SetIndexStyle(2, DRAW_ARROW);
SetIndexBuffer(2, DirBuffer);
SetIndexEmptyValue(2, 0);
SetIndexArrow(2, 234);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Parabolic Sell And Reverse system |
//+------------------------------------------------------------------+
int start()
{
if(last == 0)
ArrayInitialize(DirBuffer,0);
last = Bars;
int b = 0, i = 0;
for(i = 0; i <= cbars; i++)
{
// Easy to read
double HD = High[Highest(NULL, 0, MODE_HIGH, (iPeriod* 20), i)];
double LD = Low[Lowest(NULL, 0, MODE_LOW, (iPeriod* 20), i)];
double amplitude = HD - LD;
if(amplitude != 0)
Buffer = ((Close - (HD - (amplitude / 2))) / amplitude)*iPeriod;
else
Buffer = Close*iPeriod;
}
double dir = 0;
for(i = cbars; i >= 0; i--)
{
SigBuffer = 0;
DirBuffer = 0;
if(Buffer*Buffer[i+1] < 0)
{
if(Buffer < 0)
DirBuffer = Buffer;
else
SigBuffer = Buffer;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+

发表于:2017-08-10 04:06只看该作者
3楼
感谢分享
韬客社区www.talkfx.co