指标名称:神龙通道升极版
版本:MT4 ver. 2.01
神龙通道立足交易系统多年,经过不断的改进,呈现升级版本!
交易技巧:
当通道中线颜色变成红色并且价格向上出现“顺向多单”字样,即为上涨趋势,观察小级别行情开始进场做多。
当通道中线颜色变成蓝色并且价格向下出现“非顺向空单”字样,即为下跌趋势,观察小级别行情开始进场做空。
建议使用级别:15M,30M
品种不限
参数
部分源码展示:
property indicator_chart_window
property indicator_buffers 16
string TimeFrame = "current time frame";
int HalfLength = 61;
int Price = PRICE_CLOSE;
//————————-
extern double ATRMultiplier=2.6;
extern double ATRM2=3.0;
extern double ATRM3=3.4;
extern double ATRM4=3.8;
extern double ATRM5=4.3;
extern int ATRPeriod=100;
extern bool 豎线为起始=true;
extern int 起始线位置=2000;
extern int bars=2000;
//——————-
bool Interpolate=true;
double up=0,dn=0;
int ud=0;
int test1=0,test2=0;
int start_1;
int 多空探测1=0,多空探测2=0,多空探测=0;
double buffer2[];
double buffer3[];
double UPBuffer[];
double DNBuffer[];
double UP2Buffer[];
double DN2Buffer[];
double B1[];
double B2[];
double C1[];
double C2[];
double D1[];
double D2[];
double E1[];
double E2[];
double F1[];
double F2[];
string indicatorFileName;
bool calculateValue;
bool returnBars;
int timeFrame;
//+——————————————————————+
//| |
//+——————————————————————+
int init()
{
if(豎线为起始) {VLineCreate("起始线",iTime(NULL,0,起始线位置));}
else {VLineDelete(0,"起始线");}
start_1=findlinesht("起始线");
cleanMark();
//————————
IndicatorBuffers(16);
HalfLength=MathMax(HalfLength,1);
//————————-
SetIndexBuffer(0,buffer2);
SetIndexDrawBegin(0,HalfLength);
SetIndexStyle(0,DRAW_LINE,0,2,clrGray);
SetIndexBuffer(1,buffer3);
SetIndexDrawBegin(1,HalfLength);
SetIndexStyle(1,DRAW_LINE,0,2,clrGray);
//—————————-
SetIndexBuffer(2,UPBuffer);
SetIndexArrow(2,236);
SetIndexStyle(2,DRAW_ARROW,EMPTY,2,Purple);
SetIndexBuffer(3,DNBuffer);
SetIndexArrow(3,78);
SetIndexStyle(3,DRAW_ARROW,EMPTY,2,clrYellow);
SetIndexBuffer(4,UP2Buffer);
SetIndexArrow(4,238);
SetIndexStyle(4,DRAW_ARROW,EMPTY,2,clrYellow);
SetIndexBuffer(5,DN2Buffer);
SetIndexArrow(5,77);
SetIndexStyle(5,DRAW_ARROW,EMPTY,2,clrYellow);
//————————-
SetIndexBuffer(6,B1);
SetIndexDrawBegin(6,HalfLength);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT,1,clrGray);
SetIndexBuffer(7,B2);
SetIndexDrawBegin(7,HalfLength);
SetIndexStyle(7,DRAW_LINE,2,1,clrGray);
SetIndexBuffer(8,C1);
SetIndexDrawBegin(8,HalfLength);
SetIndexStyle(8,DRAW_LINE,2,1,clrGray);
SetIndexBuffer(9,C2);
SetIndexDrawBegin(9,HalfLength);
SetIndexStyle(9,DRAW_LINE,2,1,clrGray);
SetIndexBuffer(10,D1);
SetIndexDrawBegin(10,HalfLength);
SetIndexStyle(10,DRAW_LINE,2,1,clrGray);
SetIndexBuffer(11,D2);
SetIndexDrawBegin(11,HalfLength);
SetIndexStyle(11,DRAW_LINE,2,1,clrGray);
SetIndexBuffer(12,E1);
SetIndexDrawBegin(12,HalfLength);
SetIndexStyle(12,DRAW_LINE,0,1,clrGray);
SetIndexBuffer(13,E2);
SetIndexDrawBegin(13,HalfLength);
SetIndexStyle(13,DRAW_LINE,0,1,clrGray);
//———————————
SetIndexBuffer(14,F1);
SetIndexDrawBegin(14,HalfLength);
SetIndexStyle(14,DRAW_LINE,0,2,HotPink);
SetIndexBuffer(15,F2);
SetIndexDrawBegin(15,HalfLength);
SetIndexStyle(15,DRAW_LINE,0,2,DeepSkyBlue);
//———————————
returnBars = TimeFrame=="returnBars"; if(returnBars) return(0);
calculateValue = TimeFrame=="calculateValue"; if(calculateValue) return(0);
timeFrame=stringToTimeFrame(TimeFrame);
IndicatorShortName(timeFrameToString(timeFrame)+" TMAXZ含未来 )"+HalfLength+")");
return(0);
}
//+——————————————————————+
//| |
//+——————————————————————+
int deinit()
{
VLineDelete(0,"起始线");
cleanMark();
return(0);
}
//+——————————————————————+
//| |
//+——————————————————————+
int start()
{
TMA(61,PRICE_CLOSE,ATRM2,100,B1,B2,0);
TMA(61,PRICE_CLOSE,ATRM3,100,C1,C2,0);
TMA(61,PRICE_CLOSE,ATRM4,100,D1,D2,0);
TMA(61,PRICE_CLOSE,ATRM5,100,E1,E2,0);
if(findlinesht("起始线")!=start_1)
{
cleanMark();
up=0;dn=0;ud=0;
start_1=findlinesht("起始线");
MarkBS();
}
up=0;dn=0;ud=0;
MarkBS();
return(0);
}
string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};
//+——————————————————————+
//| |
//+——————————————————————+
int stringToTimeFrame(string tfs)
{
tfs=StringUpperCase(tfs);
for(int i=ArraySize(iTfTable)-1; i>=0; i–)
if(tfs==sTfTable[i] || tfs==""+iTfTable[i]) return(MathMax(iTfTable[i],Period()));
return(Period());
}
//+——————————————————————+
//| |
//+——————————————————————+
string timeFrameToString(int tf)
{
for(int i=ArraySize(iTfTable)-1; i>=0; i–)
if(tf==iTfTable[i]) return(sTfTable[i]);
return("");
}
//+——————————————————————+
//| |
//+——————————————————————+
string StringUpperCase(string str)
{
string s=str;
for(int length=StringLen(str)-1; length>=0; length–)
{
int ttttchar=StringGetChar(s,length);
if((ttttchar>96 && ttttchar<123) || (ttttchar>223 && ttttchar<256))
s=StringSetChar(s,length,ttttchar-32);
else if(ttttchar>-33 && ttttchar<0)
s=StringSetChar(s,length,ttttchar+224);
}
return(s);
}