| 以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 金字塔软件问题提交 (http://weistock.com/bbs/list.asp?boardid=2) ---- 指标 (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=139237) |
| -- 作者:qq代人发帖 -- 发布时间:2016/9/7 8:40:37 -- 指标 金字塔可以编出这样的指标:HH:=新高--2*ATR.,如果收盘小于HH,就空;LL:=新低+2*ATR;如果收盘大于LL就做多,希望高手指点一下,谢谢 |
| -- 作者:pyd -- 发布时间:2016/9/7 8:52:26 -- HH:=H-2*"ATR.atr"; LL:=l+2*"ATR.atr"; if c<hh and holding=0 then buyshort(1,1,market); if c>ll and holding=0 then buy(1,1,market); |
| -- 作者:天利豹 -- 发布时间:2016/9/7 10:05:32 -- 谢谢解答,不对,关键是新高怎么定位, |
| -- 作者:yukizzc -- 发布时间:2016/9/7 10:08:56 -- 这个要看您怎么定义新高? |
| -- 作者:天利豹 -- 发布时间:2016/9/7 10:10:21 -- //+------------------------------------------------------------------+ //| NRTR_color_line.mq4 | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters extern int ATRPeriod=14; extern double Coefficient=4.0; extern int StartBar=1000; //---- buffers double value1[]; double value2[]; bool TrendUP; double Extremum,TR,ATR,Values[100],ChannelWidth; int J,Head,Weight,Curr; int init() { //---- indicator line IndicatorBuffers(2); SetIndexStyle(0,DRAW_LINE); SetIndexArrow(0,167); SetIndexEmptyValue(0,0); SetIndexEmptyValue(1,0); SetIndexStyle(1,DRAW_LINE); SetIndexArrow(1,167); SetIndexBuffer(0,value1); SetIndexBuffer(1,value2); return(0); } int start() { int Shift; if (Close[StartBar-2] > Close[StartBar-1]) TrendUP = true; else TrendUP = false; Extremum = Close[ StartBar - 2 ]; for (Shift = StartBar - 3; Shift>=0; Shift--) {
TR = High[Shift] - Low[Shift];
if ( MathAbs( High[ Shift ] - Close[ Shift + 1 ]) > TR ) TR = MathAbs( High[ Shift ] - Close[ Shift + 1 ]);
if ( MathAbs( Low[ Shift ] - Close[ Shift + 1 ]) > TR ) TR = MathAbs( Low[ Shift ] - Close[ Shift + 1 ]);
if (Shift == StartBar - 3)
for (J = 0; J<ATRPeriod; J++) {
Values[J] = TR;
}
Values[ Head ] = TR;
ATR = 0;
Weight = ATRPeriod;
Curr = Head;
for (J = 0; J<ATRPeriod; J++) {
ATR += Values[ Curr ] * Weight;
Weight -= 1;
Curr -= 1;
if ( Curr == -1 ) Curr = ATRPeriod - 1;
}
ATR = ( 2.0 * ATR ) / ( ATRPeriod * ( ATRPeriod + 1.0 ));
Head += 1;
if (Head == ATRPeriod) Head = 0;
ChannelWidth = Coefficient * ATR;
if (TrendUP && ( Low[ Shift ] < ( Extremum - ChannelWidth ) ) ) {
TrendUP = false;
Extremum = High[ Shift ];
}
if ( !TrendUP && ( High[ Shift ] > ( Extremum + ChannelWidth) ) ) {
TrendUP = true;
Extremum = Low[ Shift ];
}
if ( TrendUP && ( Low[Shift] > Extremum ) ) Extremum = Low[ Shift ];
if ( !TrendUP && ( High[ Shift ] < Extremum ) ) Extremum = High[ Shift ];
if (TrendUP) {
value1[Shift]=Extremum - ChannelWidth;
value2[Shift]=0;
} else {
value1[Shift]=0;
value2[Shift]=Extremum + ChannelWidth;
}
} }是著名的系统 |
| -- 作者:yukizzc -- 发布时间:2016/9/7 10:44:53 -- 给点指导吧,这一对变量名看着就好厉害。。。
|
| -- 作者:天利豹 -- 发布时间:2016/9/7 11:05:52 -- false;true;这个函数,金字塔不支持 |
| -- 作者:wenarm -- 发布时间:2016/9/7 11:35:44 -- 这个是bool 类型,软件支持的 |
| -- 作者:天利豹 -- 发布时间:2016/9/7 22:07:04 -- 希望解决,谢谢 |