最新公告
  • 欢迎您光临九毛八公式指标网www.9m8.cn,本站全新改版试运行,期间内容全部免费,欢迎下载!欢迎加入本站VIP
  • 通达信仓位风控第一副图指标 源码

    正文概述    2024-04-13 10:13:24  

    这指标含有自创的自适应因子,
    举个例子就是60日均线,行情慢速时它会自动变速为70-90日均线之间,行情快速时它会自动变速为20-45日均线之间,
    它作用就是慢速代表横盘行情,需要大的均线控制,快速代表急速行情,需要小的均线加快触碰止盈位置,
    任何指标都有它的利弊,看你取谁轻,希望能帮到有缘人。


    MTR:=EMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),14);
    HD :=HIGH-REF(HIGH,1);
    LD :=REF(LOW,1)-LOW;
    DMP:=EMA(IF(HD 0 HD LD,HD,0),14);
    DMM:=EMA(IF(LD 0 LD HD,LD,0),14);
    PDI:=DMP/MTR;
    MDI:=DMM/MTR;
    ADX:=MA(ABS(MDI-PDI)/(MDI+PDI),6);

    MTRB:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
    ATRA:=(EMA(MTRB,14)/C*500)*ADX+1,NODRAW;

    VAR1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
    VAR21:=SMA(ABS(HIGH-VAR1),12,1)/SMA(MIN(HIGH-VAR1,0),12,1);
    VAR31:=EMA(VAR21,120/ATRA);
    VAR41:=HHV(HIGH,120/ATRA);
    VAR51:=-EMA(IF(HIGH =VAR41,VAR31,0),3);
    拉高:=IF(VAR51 REF(VAR51,1),IF(VAR51 50,50,VAR51),0),COLORRED,NODRAW;
    {STICKLINE(VAR51 REF(VAR51,1),0,IF(VAR51 50,50,VAR51),3,0 ),COLORRED;}
    派发:=IF(VAR51 REF(VAR51,1),IF(VAR51 50,50,VAR51),0),COLORCYAN,NODRAW;
    {STICKLINE(VAR51 REF(VAR51,1),0,IF(VAR51 50,50,VAR51),3,0),COLORCYAN;}

    VAR2:=SMA(ABS(LOW-VAR1),12,1)/SMA(MAX(LOW-VAR1,0),12,1);
    VAR3:=EMA(VAR2,120/ATRA);
    VAR4:=LLV(LOW,120/ATRA);
    VAR5:=-EMA(IF(LOW =VAR4,VAR3,0),3);
    出货:=IF(VAR5 REF(VAR5,1),IF(VAR5 -50,-50,VAR5),0),COLORGREEN,NODRAW;
    {STICKLINE(VAR5 REF(VAR5,1),0,IF(VAR5 -50,-50,VAR5),3,0),COLORGREEN;}
    进场:=IF(VAR5 REF(VAR5,1),IF(VAR5 -50,-50,VAR5),0),COLORLIRED,NODRAW;
    {STICKLINE(VAR5 REF(VAR5,1),0,IF(VAR5 -50,-50,VAR5),3,0 ),COLORLIRED;}

    {DRAWICON(VAR5 REF(VAR5,1),10,35);
    DRAWICON(VAR51 REF(VAR51,1),-5,34);}


    {DRAWICON(派发 0.001 AND 派发 0,0,2);
    DRAWICON(进场 -0.001 AND 进场 0,0,1);}


    DIF:=(EMA(CLOSE,12/ATRA)-EMA(CLOSE,26/ATRA))/C*1000;
    DEA:=EMA(DIF,9/ATRA);
    MACD:=(DIF-DEA)*5,COLORSTICK;
    MACD仓:INTPART(DIF/10)*10+20,COLORGRAY,LINETHICK3;{底仓为2成};
    M仓资金:=MACD仓*1.5,COLORGRAY,NODRAW;

    HH:=REF(HHV(H,15),1);
    LL:=REF(LLV(L,15),1);
    CC:=C;
    UP:=BARSLAST(CC
    DN:=BARSLAST(CC


    PDIA:=INTPART((100-DMP*100/MTR)/10)*10;
    {二部曲仓位}
    多头仓位:=(100-INTPART(SMA(((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100),3,1)/10)*10),COLORLIRED,LINETHICK1;
    空头仓位:=(100-INTPART(SMA(((HHV(H,27)-C)/(HHV(HIGH,27)-LLV(LOW,27))*100),3,1)/10)*10),COLORLIBLUE,LINETHICK1;
    多头:=IF(UP DN,多头仓位+50,多头仓位-20)+(INTPART((拉高+派发)/10)*20);{利用5日高低统计控制多空仓位,为防止主升时仓位太细,加入拉高和派货仓位,+-20为底仓加减,*20为追涨}
    空头:=IF(UP DN,空头仓位-20,空头仓位-20)+(INTPART((出货+进场)/10)*20);{利用5日高低统计控制多空仓位,为防止主跌时仓位太高,加入出货和进场仓位,+-20为底仓加减,*20为杀跌}
    实时仓:IF(多头仓位 空头仓位,INTPART(EMA((多头+MACD仓+PDIA)/3,3)/10)*10,INTPART(EMA((空头+MACD仓+PDIA)/3,3)/10)*10),COLORLIBLUE;
    实仓资金:实时仓*1.5,COLORLIBLUE,NODRAW;
    多头移动仓:IF(多头仓位 空头仓位,INTPART(EMA((多头+MACD仓)/2,3)/10)*10+MACD仓,INTPART(EMA((空头+MACD仓)/2,3)/10)*10),COLORLIRED;
    多仓资金:多头移动仓*1.5,COLORLIRED,NODRAW;{1.5万一只ETF封顶}


    影子:=IF(多头移动仓 =50,IF((100-多头移动仓)+50 50,100-多头移动仓+50,50),IF(实时仓 50,实时仓,(100-多头移动仓)+50)),COLORWHITE;
    影子仓:IF(影子 实时仓,影子,实时仓),COLORBROWN;
    影子仓资金:影子仓*1.5,COLORBROWN,NODRAW;

    平衡仓:INTPART((实时仓+多头移动仓+影子仓)/3/10)*10,COLORWHITE;
    平衡仓资金:平衡仓*1.5,COLORWHITE,NODRAW;
    IF(平衡仓 =50,平衡仓,DRAWNULL),COLORRED,LINETHICK3;
    IF(平衡仓 50,平衡仓,DRAWNULL),COLORGREEN,LINETHICK3;
    {DRAWNUMBER(CURRBARSCOUNT=1,MACD仓,MACD仓),COLORGRAY;}
    DRAWNUMBER(CURRBARSCOUNT=1,实时仓,实时仓),COLORLIBLUE;
    DRAWNUMBER(CURRBARSCOUNT=1,多头移动仓,多头移动仓),COLORLIRED;
    DRAWNUMBER(CURRBARSCOUNT=1,影子仓,影子仓),COLORBROWN;
    DRAWNUMBER(CURRBARSCOUNT=1,平衡仓,平衡仓),COLORWHITE;

    IF(MA(C,5) MA(C,60),MACD仓,DRAWNULL),COLORGREEN,LINETHICK3;
    IF(MA(C,5) MA(C,10) AND MA(C,10) MA(C,20) AND MA(C,20) MA(C,60),MACD仓,DRAWNULL),COLORRED,LINETHICK3;

    STICKLINE(实时仓-多头移动仓 =20,100,90,2,1),COLORLIBLUE;
    STICKLINE(多头移动仓-实时仓 =0,100,90,2,1),COLORLIRED;
    STICKLINE(多头移动仓 =影子仓,100,95,2,0),COLORYELLOW;
    STICKLINE(多头移动仓 影子仓,90,95,2,1),COLORWHITE;
    DRAWICON(CROSS(99,多头移动仓),100,2);

    冲高仓:=50,COLORYELLOW,NODRAW;


    -30,COLORGRAY;
    0,COLORGRAY;
    半仓:50,COLORGRAY,DOTLINE;
    满仓:=100,COLORBLUE,DOTLINE;

    通达信仓位风控第一副图指标 源码

    通达信仓位风控第一副图指标 源码

    九毛八公式指标,一个优质的公式指标平台!
    九毛八公式指标 » 通达信仓位风控第一副图指标 源码 加入收藏