通达信对角戏画线公式

[复制链接]
查看94 | 回复0 | 2022-7-24 07:57:18 | 显示全部楼层 |阅读模式

通达信对角戏画线公式

{请设置参数:HDAY 1 999 40 寻找区间高点
 LDAY 1 999 15 寻找区间低点
 上角度 0 9999 200 调整中心红线角度
 下角度 0 9999 200 调整中心红线角度
调点 1 4 2 移动角起点}
 CURR:=CURRBARSCOUNT;
 TCH:=CONST(FINDHIGH(H,0,HDAY*10,1));
 GTT:=CONST(BARSLAST(TCH=H))+1;
 SX跌H:=CONST(IF(GTT=1,H,REF(H,GTT-1)));
 BCL:=CONST(FINDLOW(L,0,LDAY*10,1));
 DTT:=CONST(BARSLAST(BCL=L))+1;
 SX涨L:=CONST(IF(DTT=1,L,REF(L,DTT-1)));
 涨点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L=SX涨L)+1));
 跌点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H=SX跌H)+1));
 最低:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,涨点,跌点)));
 L斜率:=下角度/IF(C<300,1000,10);
 最高:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,跌点,涨点)));
 H斜率:=上角度/IF(C<300,1000,10);
 IM68:=((SX跌H-SX涨L)/8-(SX跌H-SX涨L)/8);
 GH跌X:=SX跌H+(SX跌H-SX涨L)/8;  DL涨X:=SX涨L-(SX跌H-SX涨L)/8;
 GTHT:=IF(DTT>GTT,DTT,GTT);R:=ABS(GTT-DTT);
 DRAWBAND(IF(CURR<=GTHT+R/8,GH跌X,DRAWNULL),RGB(30,60,20),DL涨X,RGB(80,124,124));
 DRAWBAND(IF(CURR<=GTHT+R/8,SX跌H-(SX跌H-SX涨L)*0.191,DRAWNULL),RGB(60,80,20),SX跌H-(SX跌H-SX涨L)*0.809,RGB(80,124,24));
 DRAWBAND(IF(CURR<=GTHT+R/8,SX跌H-(SX跌H-SX涨L)*0.382,DRAWNULL),RGB(0,80,80),SX跌H-(SX跌H-SX涨L)*0.618,RGB(0,124,154));
 DRAWBAND(IF(CURR<=GTHT+R/8,(SX跌H+SX涨L)/2,DRAWNULL),RGB(60,100,20),(SX跌H+SX涨L)/2,RGB(8,168,168));
 DRAWBAND(IF(CURR<=GTHT+R/8,SX跌H,DRAWNULL),RGB(0,120,120),SX跌H,RGB(8,168,168));
 DRAWBAND(IF(CURR<=GTHT+R/8,SX涨L,DRAWNULL),RGB(0,120,120),SX涨L,RGB(0,160,160));
 
天线:=SX跌H; 地线:=SX涨L;
 K:=(天线-地线)/(IF(跌点>=涨点,跌点,涨点)-IF(跌点>=涨点,涨点,跌点));
 上斜线:=IF(地线+CONST(L斜率*4.5)*最低>=地线,地线+CONST(L斜率*4.5)*最低,DRAWNULL);
 上斜线0:=IF(地线+CONST(L斜率*2.0618)*最低>=地线,地线+CONST(L斜率*2.0618)*最低,DRAWNULL);
 上斜线1:=IF(地线+CONST(L斜率*1.5)*最低>=地线,地线+CONST(L斜率*1.5)*最低,DRAWNULL);
 上斜线2:=IF(地线+CONST(L斜率*1.00)*最低>=地线,地线+CONST(L斜率*1.000)*最低,DRAWNULL);
 上斜线3:=IF(地线+CONST(L斜率*0.650)*最低>=地线,地线+CONST(L斜率*0.650)*最低,DRAWNULL);
 上斜线4:=IF(地线+CONST(L斜率*0.50)*最低>=地线,地线+CONST(L斜率*0.50)*最低,DRAWNULL);
 上斜线5:=IF(地线+CONST(L斜率*0.382)*最低>=地线,地线+CONST(L斜率*0.382)*最低,DRAWNULL);
 上斜线6:=IF(地线+CONST(L斜率*0.250)*最低>=地线,地线+CONST(L斜率*0.250)*最低,DRAWNULL);
 上斜线7:=IF(地线+CONST(L斜率*0.175)*最低>=地线,地线+CONST(L斜率*0.175)*最低,DRAWNULL);
 上斜线8:=IF(地线+CONST(L斜率*0.123)*最低>=地线,地线+CONST(L斜率*0.123)*最低,DRAWNULL);
 上斜线9:=IF(地线+CONST(L斜率*0.0618)*最低>=地线,地线+CONST(L斜率*0.0618)*最低,DRAWNULL);
 尚9:IF(上斜线9<=天线*1.05,上斜线9,DRAWNULL),COLOR666666,DOTLINE;
 尚8:IF(上斜线8<=天线*1.05,上斜线8,DRAWNULL),COLOR666666,DOTLINE;
 尚7:IF(上斜线7<=天线*1.05,上斜线7,DRAWNULL),COLOR666666,DOTLINE;
 尚6:IF(上斜线6<=天线*1.05,上斜线6,DRAWNULL),COLOR666666,DOTLINE;
 尚5:IF(上斜线5<=天线*1.05,上斜线5,DRAWNULL),COLOR666666,DOTLINE;
 尚4:IF(上斜线4<=天线*1.05,上斜线4,DRAWNULL),COLOR00AAAA,DOTLINE;
 尚3:IF(上斜线3<=天线*1.05,上斜线3,DRAWNULL),COLOR666666,DOTLINE;
 尚2:IF(上斜线2<=天线*1.05,上斜线2,DRAWNULL),COLOR666666,DOTLINE;
 尚1:IF(上斜线1<=天线*1.05,上斜线1,DRAWNULL),COLOR666666,DOTLINE;
 尚0:IF(上斜线0<=天线*1.05,上斜线0,DRAWNULL),COLOR666666,DOTLINE;
 尚:IF(上斜线<=天线*1.05,上斜线,DRAWNULL),COLOR666666,DOTLINE;
 下斜线:=IF(天线-CONST(H斜率*4.5)*最高<=天线,天线-CONST(H斜率*4.5)*最高,DRAWNULL);
 下斜线0:=IF(天线-CONST(H斜率*2.0618)*最高<=天线,天线-CONST(H斜率*2.0618)*最高,DRAWNULL);
 下斜线1:=IF(天线-CONST(H斜率*1.500)*最高<=天线,天线-CONST(H斜率*1.500)*最高,DRAWNULL);
 下斜线2:=IF(天线-CONST(H斜率*1.000)*最高<=天线,天线-CONST(H斜率*1.000)*最高,DRAWNULL);
 下斜线3:=IF(天线-CONST(H斜率*0.650)*最高<=天线,天线-CONST(H斜率*0.650)*最高,DRAWNULL);
 下斜线4:=IF(天线-CONST(H斜率*0.50)*最高<=天线,天线-CONST(H斜率*0.50)*最高,DRAWNULL);
 下斜线5:=IF(天线-CONST(H斜率*0.382)*最高<=天线,天线-CONST(H斜率*0.382)*最高,DRAWNULL);
 下斜线6:=IF(天线-CONST(H斜率*0.250)*最高<=天线,天线-CONST(H斜率*0.250)*最高,DRAWNULL);
 下斜线7:=IF(天线-CONST(H斜率*0.175)*最高<=天线,天线-CONST(H斜率*0.175)*最高,DRAWNULL);
 下斜线8:=IF(天线-CONST(H斜率*0.123)*最高<=天线,天线-CONST(H斜率*0.123)*最高,DRAWNULL);
 下斜线9:=IF(天线-CONST(H斜率*0.0618)*最高<=天线,天线-CONST(H斜率*0.0618)*最高,DRAWNULL);
 下9:IF(下斜线9>=地线*0.95,下斜线9,DRAWNULL),COLOR666666,DOTLINE;
 下8:IF(下斜线8>=地线*0.95,下斜线8,DRAWNULL),COLOR666666,DOTLINE;
 下7:IF(下斜线7>=地线*0.95,下斜线7,DRAWNULL),COLOR666666,DOTLINE;
 下6:IF(下斜线6>=地线*0.95,下斜线6,DRAWNULL),COLOR666666,DOTLINE;
 下5:IF(下斜线5>=地线*0.95,下斜线5,DRAWNULL),COLOR666666,DOTLINE;
 下4:IF(下斜线4>=地线*0.95,下斜线4,DRAWNULL),COLOR00DDDD,DOTLINE;
 下3:IF(下斜线3>=地线*0.95,下斜线3,DRAWNULL),COLOR666666,DOTLINE;
 下2:IF(下斜线2>=地线*0.95,下斜线2,DRAWNULL),COLOR666666,DOTLINE;
 下1:IF(下斜线1>=地线*0.95,下斜线1,DRAWNULL),COLOR666666,DOTLINE;
 下0:IF(下斜线0>=地线*0.95,下斜线0,DRAWNULL),COLOR666666,DOTLINE;
 下:IF(下斜线>=地线*0.95,下斜线,DRAWNULL),COLOR666666,DOTLINE;
 DRAWKLINE(H,O,L,C);
 DRAWTEXT(CURR=GTHT,SX涨L,'BASE'),COLOR999999;
 DRAWTEXT(CURR=GTHT,SX跌H-(SX跌H-SX涨L)*0.809,'80.9%'),COLOR999999;
 DRAWTEXT(CURR=GTHT,SX跌H-(SX跌H-SX涨L)*0.618,'61.8%'),COLOR999999;
 DRAWTEXT(CURR=GTHT,SX跌H-(SX跌H-SX涨L)*0.50,'50%'),COLOR999999;
 DRAWTEXT(CURR=GTHT,SX跌H-(SX跌H-SX涨L)*0.382,'38.2%'),COLOR999999;
 DRAWTEXT(CURR=GTHT,SX跌H-(SX跌H-SX涨L)*0.191,'19.1%'),COLOR999999;
 DRAWTEXT(CURR=GTHT,SX跌H,'100%'),COLOR999999;

 

 

716399331.jpg

716399331.jpg

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则