线性回归带 [博易POBO]
咨询内容:
是这样的,在通达信里面是常数的意思,以下是通达信版本的,只有两个函数不一样,老师看看能不能改成博弈的
UR:=10;LR:=10;
TC1:=IF(H=HHV(H,8*UR),H,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UP:=CONST(IF(TC2=1,H,REF(H,TC2-1)));
BC1:=IF(L=LLV(L,8*LR),L,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LL:=CONST(IF(BC2=1,L,REF(L,BC2-1)));
LP:CURRBARSCOUNT<=BC2ANDL=LL;{低点定位}
HP:CURRBARSCOUNT<=TC2ANDH=UP;{高点定位}
起点:=STICKLINE(IF(BC2>TC2,HP,LP),LL,UP,0,0),COLORWHITE;
站点:=STICKLINE(IF(BC2>TC2,LP,HP),LL,UP,0,0),COLORWHITE;
NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时}
LR1:=FORCAST(C,NOD+1);{线性回归预测值}
NP:=IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;{近点}
LR2:=SLOPE(C,NOD+1);{线性回归的斜率}
LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));
FP:=NP-LR3*(NOD),POINTDOT,COLOR93BDA8;{远点}
EQU:=(NP+FP)/2,POINTDOT,COLOR93BDA8;
AD:=ABS(NP-FP);{高差};
DBL:=BARSLAST(BC1!=DRAWNULL)+1;
DBH:=BARSLAST(TC1!=DRAWNULL)+1;
BSP:=IF(BC2>TC2,DBL,DBH)-1;
LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2)ANDH>LRL,H,LRL);
AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
AT3:=CONST(BARSLAST(AT1-LRL=AT2));
AT4:=CONST(IF(AT3=0,H,REF(H,AT3)));
AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));
ATL:=LRL+AT5;
ATL1:=LRL-AT5;
UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2)ANDL<LRL,L,LRL);
UT2:=HHV(LRL-UT1,MAX(BC2,TC2));
UT3:=CONST(BARSLAST(LRL-UT1=UT2));
UT4:=CONST(IF(UT3=0,H,REF(H,UT3)));
UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));
UTL:=LRL-UT5;
UTL1:=LRL+UT5;
RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-15,ATL,CONST(REF(ATL,MIN(BC2,TC2)-15)));{限制高}
RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-15,UTL,CONST(REF(UTL,MIN(BC2,TC2)-15)));{限制低}
上轨:IF(NP>FP,IF(ATL1<=RH,UTL1,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLORGREEN,DOTLINE;
中轨:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLORWHITE,DOTLINE;
下轨:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL1>=RL,ATL1,DRAWNULL)),COLORRED,DOTLINE;
NOTEXT中轨:=IF(NP>FP,IF(LRL<=CONST(REF(LRL,BARSLASTCOUNT(H<LRL))),LRL,DRAWNULL),IF(LRL>=CONST(REF(LRL,BARSLASTCOUNT(L>LRL))),LRL,DRAWNULL)),COLORWHITE;
NOTEXT上轨:IF(NP>FP,IF(UTL1<=CONST(REF(UTL1,BARSLASTCOUNT(H<LRL))),UTL1,DRAWNULL),IF(ATL>=CONST(REF(ATL,BARSLASTCOUNT(L>LRL))),ATL,DRAWNULL)),COLORGREEN,LINETHICK2;
NOTEXT下轨:IF(NP>FP,IF(UTL<=CONST(REF(UTL,BARSLASTCOUNT(H<LRL))),UTL,DRAWNULL),IF(ATL1>=CONST(REF(ATL1,BARSLASTCOUNT(L>LRL))),ATL1,DRAWNULL)),COLORRED,LINETHICK2; 来源 程序化久久网
线性回归带
来源:程序化99网( WWW.CXH99.COM )
博易技术人员: 您好,使用未来函数REFX取之后10000个周期的数值,这样的写法是不合理的。不是很清楚这个代码的作者的编写意图,不过暂且把10000改了小试试看。请看下是不是您要的图形。是这样的,在通达信里面是常数的意思,以下是通达信版本的,只有两个函数不一样,老师看看能不能改成博弈的
UR:=10;LR:=10;
TC1:=IF(H=HHV(H,8*UR),H,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UP:=CONST(IF(TC2=1,H,REF(H,TC2-1)));
BC1:=IF(L=LLV(L,8*LR),L,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LL:=CONST(IF(BC2=1,L,REF(L,BC2-1)));
LP:CURRBARSCOUNT<=BC2ANDL=LL;{低点定位}
HP:CURRBARSCOUNT<=TC2ANDH=UP;{高点定位}
起点:=STICKLINE(IF(BC2>TC2,HP,LP),LL,UP,0,0),COLORWHITE;
站点:=STICKLINE(IF(BC2>TC2,LP,HP),LL,UP,0,0),COLORWHITE;
NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时}
LR1:=FORCAST(C,NOD+1);{线性回归预测值}
NP:=IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL),POINTDOT,COLOR93BDA8;{近点}
LR2:=SLOPE(C,NOD+1);{线性回归的斜率}
LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1)));
FP:=NP-LR3*(NOD),POINTDOT,COLOR93BDA8;{远点}
EQU:=(NP+FP)/2,POINTDOT,COLOR93BDA8;
AD:=ABS(NP-FP);{高差};
DBL:=BARSLAST(BC1!=DRAWNULL)+1;
DBH:=BARSLAST(TC1!=DRAWNULL)+1;
BSP:=IF(BC2>TC2,DBL,DBH)-1;
LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP);
AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2)ANDH>LRL,H,LRL);
AT2:=HHV(AT1-LRL,MAX(BC2,TC2));
AT3:=CONST(BARSLAST(AT1-LRL=AT2));
AT4:=CONST(IF(AT3=0,H,REF(H,AT3)));
AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3)));
ATL:=LRL+AT5;
ATL1:=LRL-AT5;
UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2)ANDL<LRL,L,LRL);
UT2:=HHV(LRL-UT1,MAX(BC2,TC2));
UT3:=CONST(BARSLAST(LRL-UT1=UT2));
UT4:=CONST(IF(UT3=0,H,REF(H,UT3)));
UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3)));
UTL:=LRL-UT5;
UTL1:=LRL+UT5;
RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-15,ATL,CONST(REF(ATL,MIN(BC2,TC2)-15)));{限制高}
RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-15,UTL,CONST(REF(UTL,MIN(BC2,TC2)-15)));{限制低}
上轨:IF(NP>FP,IF(ATL1<=RH,UTL1,DRAWNULL),IF(ATL>=RL,ATL,DRAWNULL)),COLORGREEN,DOTLINE;
中轨:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLORWHITE,DOTLINE;
下轨:IF(NP>FP,IF(UTL<=RH,UTL,DRAWNULL),IF(UTL1>=RL,ATL1,DRAWNULL)),COLORRED,DOTLINE;
NOTEXT中轨:=IF(NP>FP,IF(LRL<=CONST(REF(LRL,BARSLASTCOUNT(H<LRL))),LRL,DRAWNULL),IF(LRL>=CONST(REF(LRL,BARSLASTCOUNT(L>LRL))),LRL,DRAWNULL)),COLORWHITE;
NOTEXT上轨:IF(NP>FP,IF(UTL1<=CONST(REF(UTL1,BARSLASTCOUNT(H<LRL))),UTL1,DRAWNULL),IF(ATL>=CONST(REF(ATL,BARSLASTCOUNT(L>LRL))),ATL,DRAWNULL)),COLORGREEN,LINETHICK2;
NOTEXT下轨:IF(NP>FP,IF(UTL<=CONST(REF(UTL,BARSLASTCOUNT(H<LRL))),UTL,DRAWNULL),IF(ATL1>=CONST(REF(ATL1,BARSLASTCOUNT(L>LRL))),ATL1,DRAWNULL)),COLORRED,LINETHICK2; 来源 程序化久久网
有思路,想编写各种指标公式,交易模型,选股公式,还原公式的朋友
可联系技术人员 QQ: 262069696 或微信号:cxh99cxh99 进行 有偿收费 编写!
(注:由于人数限制,QQ或微信请选择方便的一个联系我们就行,加好友时请简单备注下您的需求,否则无法通过。谢谢您!)
相关文章
-
没有相关内容