通达信没有大智慧和同花顺那样的模拟K线功能。有会员提出需要这个公式,就做了一个,时间有限,水平般般,需要的会员就将就着用吧;不论怎样做也没有大智慧和同花顺的方便。已经重新工作了就没有大把时间为大家服务了,请包含;这个公式就算给大家的五一节的小小礼品吧;考虑到有一些会员币值不多了,就发原码
了;祝大家五一节快乐!!!
说明:
1:调节各个参数来实现模拟成交量和k线‘
2:第一行文字提示是模拟成交量和k线的数据;
3:第:二行文字提示是模拟各个平均线是否向上了;
4:上k线是模拟k线;
5:下k线是模拟成交量;
6:这个公式是副图公式;
{参数: 高(0,9999,767),开(0,9999,713),低(0,9999,705),收(0,999,750),量差(-999,999,0); }
DRAWKLINE(REFX(H,1),REFX(O,1),REFX(L,1),REFX(C,1));
高高:=IF(ISLASTBAR AND 高/100<=C*1.096 AND 高/100>=C*0.99,高/100,H);
收收:=IF(ISLASTBAR AND 收/100<=C*1.096 AND 收/100>=C*0.99,收/100,C);
开开:=IF(ISLASTBAR AND 开/100<=C*1.096 AND 开/100>=C*0.99,开/100,O);
低低:=IF(ISLASTBAR AND 低/100<=C*1.096 AND 低/100>=C*0.99,低/100,L);
涨跌幅:=(收收/C-1)*100;
STICKLINE(ISLASTBAR AND 收收>=开开,高高,低低,0,0 ),COLORFF00FF;
STICKLINE(ISLASTBAR AND 收收>=开开,开开,收收,2.5,0),COLORFF00FF;
STICKLINE(ISLASTBAR AND 收收<开开,高高,低低,0,0 ),COLOR00FF00;
STICKLINE(ISLASTBAR AND 收收<开开,开开,收收,2.5,0),COLOR00FF00;
线5:IF(NOT(ISLASTBAR),REFX(MA(C,5),1),(MA(C,4)*4+收收)/5),COLORFFFFFF;
线10:IF(NOT(ISLASTBAR),REFX(MA(C,10),1),(MA(C,9)*9+收收)/10),COLOR009FFF;
线30:IF(NOT(ISLASTBAR),REFX(MA(C,30),1),(MA(C,29)*29+收收)/30),COLORFFFF00;
线60:IF(NOT(ISLASTBAR),REFX(MA(C,60),1),(MA(C,59)*59+收收)/60),COLOR99FF00;
线120:IF(NOT(ISLASTBAR),REFX(MA(C,120),1),(MA(C,119)*119+收收)/120),COLOR00FF00;
线250:IF(NOT(ISLASTBAR),REFX(MA(C,250),1),(MA(C,249)*249+收收)/250),COLORFF9966;
{叠加成交量}
HH:=CONST(HHV(H,140)); LL:=CONST(LLV(L,140));
VH:=CONST(HHV(V,140)); VL:=CONST(LLV(V,140));
YY:=5;{调节叠加成交量占比}
HL:=LL+(LL-HH)/YY;
VV:=REFX((V-VL)/(VH-VL)*(LL-HL)+HL,1);
DRAWBAND(LL,RGB(100,100,100),HL,RGB(100,100,100));
STICKLINE(REFX(C>=O,1),VV,HL,2.5,1),COLOR0000FF;
STICKLINE(REFX(C<O,1),VV,HL,2.5,0),COLORFFFF00;
DV:=IF(ISLASTBAR,REF(VV,1)*(1+量差/1000),DRAWNULL);
量:=INTPART(V*(1+量差/1000));
STICKLINE(ISLASTBAR AND 收收>=开开,DV,HL,2.5,0),COLORFF00FF;
STICKLINE(ISLASTBAR AND 收收<开开,DV,HL,2.5,0 ),COLOR00FF00;
{文字提示}
DRAWTEXT_FIX(ISLASTBAR,0,0,0,'███████████████'),COLOR336622;
DRAWTEXT_FIX(ISLASTBAR,0.01,0,0,'休闲制【模拟 量-K线】'),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.3,0,0,STRCAT('开盘价:',CON2STR(开开,2))),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.4,0,0,STRCAT('最高价:',CON2STR(高高,2))),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.5,0,0,STRCAT('最低价:',CON2STR(低低,2))),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.6,0,0,STRCAT('收盘价:',CON2STR(收收,2))),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.7,0,0,STRCAT(STRCAT('涨跌幅:',CON2STR(涨跌幅,2)),'﹪')),COLORFFFFFF;
DRAWTEXT_FIX(ISLASTBAR,0.8,0,0,STRCAT(STRCAT('成交量:',CON2STR(量,0)),'手')),COLORFFFFFF;
DRAWTEXT_FIX(线5>REF(线5,1),0.3,0.05,0,'线5向上'),COLOR00FFFF;
DRAWTEXT_FIX(线10>REF(线10,1),0.4,0.05,0,'线10向上'),COLOR00FFFF;
DRAWTEXT_FIX(线30>REF(线30,1),0.5,0.05,0,'线30向上'),COLOR00FFFF;
DRAWTEXT_FIX(线60>REF(线60,1),0.6,0.05,0,'线60向上'),COLOR00FFFF;
DRAWTEXT_FIX(线120>REF(线120,1),0.7,0.05,0,'线120向上'),COLOR00FFFF;
DRAWTEXT_FIX(线250>REF(线250,1),0.8,0.05,0,'线250向上'),COLOR00FFFF;