<ins id="d3tjn"><th id="d3tjn"><delect id="d3tjn"></delect></th></ins>

        <strike id="d3tjn"><span id="d3tjn"><ol id="d3tjn"></ol></span></strike>

        <output id="d3tjn"></output>

            您現在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔模型>>正文內容

            金字塔多頭策略/空頭策略 DD-link /KK-link 時間網格交易策略源碼[金字塔模型]

            ?

            //+++++++++++++++++++DD-LINK+++++++++++++++++++++++++++
            ?
            //WARNING_DISABLE:9;
            {===========================================================================================}
            INPUT:T0(3,2,240,1),BMIN(1,1,100,1),BMAX(40,1,100,1);
            HOLDING0:=IF(HOLDING<>DAYHOLDING,DAYHOLDING,HOLDING);
            AVGENTERPRICE0:=IF(AVGENTERPRICE<>AVGENTERPRICE,AVGENTERPRICE,AVGENTERPRICE);
            {===========================================================================================}
            {
            TR0:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)),NOAXIS;//,LINETHICK0;
            ATR0:MA(TR0,14),NOAXIS;//,LINETHICK0;
            ?
            TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW)),NOAXIS;//,LINETHICK0;
            ATR1:REF(MA(TR1,14),1),NOAXIS;//,LINETHICK0;
            {===========================================================================================}
            OPEND:="$OPEN#DAY";
            CLOSED:="$CLOSE#DAY";
            HIGHD:="$HIGH#DAY";
            LOWD:="$LOW#DAY";
            VOLD:="$VOL#DAY";
            ?
            BZJ0:=ROUND( ( REF(CLOSED,0) * MULTIPLIER * (TACCOUNT(41)+TACCOUNT(42))/2 ) ),NOAXIS,LINETHICK0;
            FY0:=OPENPROFIT,NOAXIS;//,LINETHICK0;
            保0:BZJ0,NOAXIS,LINETHICK0;
            浮0:FY0,NOAXIS,LINETHICK0;
            ?
            ZCK0:=ROUND( ( (( CASH(0)+CASH(1) )/2) * (BMIN/100) ) / BZJ0 ),NOAXIS,LINETHICK0;
            ZCK1:=ROUND( ( (( CASH(0)+CASH(1) )/2) * (BMAX/100) ) / BZJ0 ),NOAXIS,LINETHICK0;
            基:ZCK0,NOAXIS,LINETHICK0;
            極:ZCK1,NOAXIS,LINETHICK0;
            ?
            ZCB0:=( (CASH(0)+CASH(1))/2 )/(ASSET),NOAXIS,LINETHICK0;
            比:=ZCB0,NOAXIS,LINETHICK0;
            ?
            JYF0:=GEGCHARGE(\'\',REF(CLOSED,0),1,0)*2,NOAXIS,LINETHICK0;
            費:JYF0,NOAXIS,LINETHICK0;
            ?
            MMC0:=( (DYNAINFO(34)-DYNAINFO(28)) )*MULTIPLIER,NOAXIS,LINETHICK0;
            差:MMC0,NOAXIS,LINETHICK0;
            ?
            ZXBD:=DYNAINFO(208)*MULTIPLIER,NOAXIS,LINETHICK0;
            //XS:( IF(JYF>=MMC,JYF,MMC)-IF(MMC>=JYF,JYF,MMC) )/IF(JYF>=MMC,JYF,MMC),NOAXIS,LINETHICK0;
            //DC:(1+ROUND(IF(XS<=1,1,XS)))*( (DYNAINFO(34)-DYNAINFO(28)) ),NOAXIS,LINETHICK0;
            ?
            {===========================================================================================}
            倉:HOLDING0,NOAXIS,LINETHICK0;
            資:ASSET,NOAXIS,LINETHICK1;
            金:CASH(0),NOAXIS,LINETHICK0;
            凈:NETPROFIT,NOAXIS,COLORYELLOW,LINETHICK0;
            浮:OPENPROFIT,NOAXIS,LINETHICK0;
            幅:OPENPROFITPER,NOAXIS,LINETHICK0;
            撤:MAXDRAWDOWN,NOAXIS,LINETHICK0;
            幅0:MAXDRAWDOWNPCT,NOAXIS,LINETHICK0;
            虧:GROSSLOSS,NOAXIS,LINETHICK0;
            盈:BESTTRADE,NOAXIS,LINETHICK0;
            回:ANNUALRETURNRATER,NOAXIS,LINETHICK0;
            年:ANNUALRETURNRATE,NOAXIS,LINETHICK0;
            風:=PROFITRISKRATIO,NOAXIS,LINETHICK0;
            次:=TOTALDAYTRADE,NOAXIS,LINETHICK0;
            {++++++++++++++++++++++++++++++++++}
            HMIN:=ZCK0;
            HMAX:=ZCK1;
            H1:=HMIN;
            H2:=H1*2;
            H3:=H1*3;
            {=============================================================================}
            ZQ1:=IF(DATATYPE=1,1,0);
            ZQ3:=IF(DATATYPE=17,3,0);
            ZQ5:=IF(DATATYPE=2,5,0);
            ZQ10:=IF(DATATYPE=18,10,0);
            ZQ15:=IF(DATATYPE=3,15,0);
            ZQ30:=IF(DATATYPE=4,30,0);
            ZQ60:=IF(DATATYPE=5,60,0);
            ZQF:=IF(DATATYPE=13,DATATYPEMORE(2),0);
            ZQH:=IF(DATATYPE=11,DATATYPEMORE(1)*60,0);
            ZQ:=ZQ1+ZQ3+ZQ5+ZQ10+ZQ15+ZQ30+ZQ60+ZQF+ZQH,NOAXIS;
            CYC:=BARSLAST(DATE<>REF(DATE,1))+1,NOAXIS;
            JY:=IF(HIGH+LOW-OPEN-CLOSE=0,0,1),NOAXIS;
            TK:=TIME>OPENTIME(1) AND TIME<CLOSETIME(0)-10*100,NOAXIS;
            TS:=TIME>=CLOSETIME(0)-10*100,NOAXIS;
            F:="ZQ";
            OPENMIN1:="$OPEN#MINF";
            OPENDAY:="$OPEN#DAY";
            OPENSTART:=IF(OPENMIN1=OPENDAY,1,0);
            OST:=FILTER(OPENSTART,CYC);
            KPJY:=HOLDING0=0 AND OST>=1 AND TK>=1 AND JY=1 AND CYC>=1;
            SPJY:= TS=1;
            {====================================================================================================}
            //收盤:SELL(SPJY,HOLDING0,THISCLOSE);{CLOSE}
            //開盤:BUY(KPJY,HMIN,THISCLOSE);{OPEN}
            //SELLSHORT(SPJY,DAYHOLDING,THISCLOSE);{CLOSE}
            //BUYSHORT(KPJY,1,THISCLOSE);{OPEN}
            {============================================================================================}
            //INPUT:N(1,1,100,1);
            D:=T0;//10;//RAND(9)+5,NOAXIS,LINETHICK0;
            隔:=D,NOAXIS,LINETHICK0;
            D1:=IF(D<=2,2,D),NOAXIS,LINETHICK0;
            D2:=RET(OPENMINUTES(CURRENTTIME),1),NOAXIS,LINETHICK0;
            D3:=RET(OPENMINUTES(TIME),1),NOAXIS,LINETHICK0;
            日:=D2,NOAXIS;//,LINETHICK0;
            分:=D3,NOAXIS;//,LINETHICK0;
            {+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
            X0:=IF(HIGH+LOW-OPEN-CLOSE=0,0,1),NOAXIS,LINETHICK0;
            X1:=REF(X0,1),NOAXIS,LINETHICK0;
            {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
            A1:=OPENMINUTES(TIME)/D,NOAXIS,LINETHICK0;
            A2:=INTPART(A1),NOAXIS,LINETHICK0;
            A3:=FRACPART(A1),NOAXIS,LINETHICK0;
            A4:=(A2/A3),NOAXIS,LINETHICK0;
            A5:=(A2-D),NOAXIS,LINETHICK0;
            A6:=IF((A4-A5)=D,1,0),NOAXIS,LINETHICK0;
            {===========================================================================+}
            BBUY:=OPEN-IF(AVGENTERPRICE0=0,OPEN,AVGENTERPRICE0),NOAXIS;
            本 :=BBUY,NOAXIS,COLORBLUE;//,LINETHICK0;
            本0:IF(AVGENTERPRICE=0,OPEN,AVGENTERPRICE),COLORRED;//,NOAXIS;//,LINETHICK0;
            {============================================================}
            B0:=1*(DYNAINFO(34)-DYNAINFO(28)),NOAXIS,LINETHICK0;
            B1:=IF(B0<=0,MINDIFF,B0),NOAXIS,LINETHICK0;
            差:=B1,NOAXIS;//,LINETHICK0;
            ?
            {++++++++++++++++++++++++++++++++++++++}
            {
            FY1:FY0/BZJ0/1,NOAXIS;//,LINETHICK0;
            FY2:FY0/BZJ0/2,NOAXIS;//,LINETHICK0;
            FY3:FY0/BZJ0/3,NOAXIS;//,LINETHICK0;
            FY4:FY0/BZJ0/4,NOAXIS;//,LINETHICK0;
            FY5:FY0/BZJ0/5,NOAXIS;//,LINETHICK0;
            FY6:FY0/BZJ0/6,NOAXIS;//,LINETHICK0;
            //? ?FILTER((FY0>BZJ0),ENTERBARS)
            ?
            {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
            ?
            KPD:=01 AND BBUY>B1*7 AND X1;
            控平多:SELL(KPD ,HOLDING0/H3,THISCLOSE),NOAXIS,LINETHICK0;
            //控平多:SELL( HOLDING0>0 AND FY0>=BZJ0 AND X1,(HOLDING0)/H3,THISCLOSE),NOAXIS,LINETHICK0;
            {===========================================================================}
            //開盤:SELL((D2+D3)=D2+1,HOLDING,MARKETR),NOAXIS,LINETHICK0;
            隨機開多:BUY(? HOLDING0=0 AND X1 AND A6,BMIN,THISCLOSE),NOAXIS,LINETHICK0;
            {===========================================================================}
            控加多0:BUY(01<HOLDING0<02 AND (BBUY+B1*05)<-B1*07 AND X1 AND A6,H2,THISCLOSE),NOAXIS,LINETHICK0;
            控加多1:BUY(02<HOLDING0<03 AND (BBUY+B1*07)<-B1*11 AND X1 AND A6,H3,THISCLOSE),NOAXIS,LINETHICK0;
            控加多2:BUY(03<HOLDING0<05 AND (BBUY+B1*11)<-B1*13 AND X1 AND A6,H1,THISCLOSE),NOAXIS,LINETHICK0;
            控加多3:BUY(05<HOLDING0<07 AND (BBUY+B1*13)<-B1*17 AND X1 AND A6,H2,THISCLOSE),NOAXIS,LINETHICK0;
            控加多4:BUY(07<HOLDING0<11 AND (BBUY+B1*17)<-B1*19 AND X1 AND A6,H3,THISCLOSE),NOAXIS,LINETHICK0;
            控加多5:BUY(11<HOLDING0<13 AND (BBUY+B1*19)<-B1*23 AND X1 AND A6,H1,THISCLOSE),NOAXIS,LINETHICK0;
            控加多6:BUY(13<HOLDING0<17 AND (BBUY+B1*23)<-B1*29 AND X1 AND A6,H2,THISCLOSE),NOAXIS,LINETHICK0;
            控加多7:BUY(17<HOLDING0<19 AND (BBUY+B1*29)<-B1*31 AND X1 AND A6,H3,THISCLOSE),NOAXIS,LINETHICK0;
            控加多8:BUY(19<HOLDING0<23 AND (BBUY+B1*31)<-B1*37 AND X1 AND A6,H1,THISCLOSE),NOAXIS,LINETHICK0;
            控加多9:BUY(23<HOLDING0<29 AND (BBUY+B1*37)<-B1*41 AND X1 AND A6,H2,THISCLOSE),NOAXIS,LINETHICK0;
            {===========================================================================}
            {
            JD:=#KK-LINK.KPK(1)#;
            加多0:BUY(JD=1 AND X1 AND A6,H2,THISCLOSE),NOAXIS,LINETHICK0;
            {===========================================================================}
            {
            控平多0:SELL(IF( HOLDING0>HMAX/3,1,0) AND FILTER((BBUY>B1*0),ENTERBARS) AND X1,HOLDING0/H2,THISCLOSE),NOAXIS,LINETHICK0;
            控平多1:SELL(IF( HOLDING0>HMAX/2,1,0) AND FILTER((BBUY>B1*0),ENTERBARS) AND X1,HOLDING0/H2,THISCLOSE),NOAXIS,LINETHICK0;
            //控平多3:SELL(IF( HOLDING0>HMAX/1,1,0) AND FILTER((BBUY>B1*0),ENTERBARS) AND X1,HOLDING0/H2,THISCLOSE),NOAXIS,LINETHICK0;
            ?
            {=============================================================================}
            ?
            ?
            {===============================================================================}
            //開盤0:SELL((D2+D3)=D2+1,HOLDING,MARKETR),NOAXIS,LINETHICK0;
            //收盤清倉0:SELL( (D2-D3)=1 ,HOLDING0,THISCLOSE),NOAXIS,LINETHICK0;
            ?
            //收盤清倉:SELL( SPJY ,HOLDING0,THISCLOSE),NOAXIS,LINETHICK0;
            {======================================================================================}
            ?
            ?
            ?
            ?
            ?
            ?
            ?
            ?
            ?
            ?
            ?
            {++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
            //開盤全平:SELL((D2+D3)=D2+1,HOLDING,MARKETR),NOAXIS,LINETHICK0;
            //開多:BUY(X1 AND A6,1,MARKETR),NOAXIS,LINETHICK0;
            //加多:BUY(B1<0 AND A6,1,MARKETR),NOAXIS,LINETHICK0;
            //控平多:SELL(B1>=5,HOLDING/2,MARKETR),NOAXIS,LINETHICK0;
            //收盤清倉:SELL((D2-D3)<=1 ,HOLDING,MARKETR),NOAXIS,LINETHICK0;
            {============================================================================}
            ?
            {===========================================================================}
            //開盤全平:SELL((D2+D3)=D2+1,HOLDING,THISCLOSE),ORDERQUEUE,NOAXIS,LINETHICK0;
            //開多:BUY(X1 AND A6,1,THISCLOSE),ORDERQUEUE,NOAXIS,LINETHICK0;
            //加多:BUY(B1<0 AND A6,1,THISCLOSE),ORDERQUEUE,NOAXIS,LINETHICK0;
            //控平多:SELL(B1>=5,HOLDING/2,THISCLOSE),ORDERQUEUE,NOAXIS,LINETHICK0;
            //收盤清倉:SELL((D2-D3)<=1 ,HOLDING,THISCLOSE),ORDERQUEUE,NOAXIS,LINETHICK0;
            {============================================================================}
            ?
            ?
            //DATAPERIAD
            //BUY(X1 AND OPENMINUTES(TIME)=0,1,THISCLOSE);
            {
            //SELL(X AND ENTERBARS=2,0,THISCLOSE),NOAXIS,LINETHICK0;
            //固定止損部分************************
            ?
            //止盈
            IF OPEN-AVGENTERPRICE>100*MINDIFF THEN BEGIN
            SELL(1,HOLDING,THISCLOSE);
            END
            ?
            //止損
            IF AVGENTERPRICE-OPEN>10*MINDIFF THEN BEGIN
            SELL(1,HOLDING,THISCLOSE);
            END
            //BUYSHORT(A6,1,THISCLOSE),NOAXIS,LINETHICK0;
            //SELLSHORT(ENTERBARS=9,0,THISCLOSE),NOAXIS,LINETHICK0;
            }
            ?
            //A:(TIMETOT0(DYNAINFO(207)+D)-REF(TIME0,1)),NOAXIS,LINETHICK0;
            ?
            //CD1:(HOLDING=0) OR ENTERBARS=5,NOAXIS,LINETHICK0;
            //CD2:(HOLDING=0) OR EXITBARS=5,NOAXIS,LINETHICK0;
            ?
            //BUY(CD1,1,THISCLOSE);
            //SELL(CD2,1,THISCLOSE);
            //BUYSHORT(CD,1,MARKET);
            ?
            //移動止損部分************************
            //求出持倉以來的最高價或最低價,通過與當前價做比較,判斷資金回落的幅度
            //DTYDZS:=(HHV(H,ENTERBARS)-CLOSE)/AVGENTERPRICE>=0.01;
            //KTYDZS:=(CLOSE-LLV(L,ENTERBARS))/AVGENTERPRICE>=0.01;
            //SELL(DTYDZS,0,THISCLOSE);
            //SELLSHORT(KTYDZS,0,THISCLOSE);
            ?
            //PJ:IF(AVGENTERPRICE=0,OPEN,AVGENTERPRICE)-OPEN,NOAXIS;
            //PJ:AVGENTERPRICE,NOAXIS;
            ?
            {
            KD:=;? ? ? ? ? //開多條件
            PD:=;? ? ? ? ? //平多條件
            KK:=;? ? ? ? ? //開空條件
            PK:=;? ? ? ? ? //平空條件
            ?
            ?
            平空:SELLSHORT(PK,1,THISCLOSE);? ? ? ? ? ? ? ? ? //平空信號
            開多:BUY(KD AND HOLDING=0,1,THISCLOSE);? ? ? ? ? //開多信號
            平多:SELL(PD,1,THISCLOSE);? ? ? ? ? ? ? ? ? ? ? ?//平多信號
            開空:BUYSHORT(KK AND HOLDING=0,1,THISCLOSE);? ? ?//開空信號
            ?
            }
            {
            信號語句排列規則——先平后開
            “費率設置”按鈕——用于合理設置模型“費率”,以便在圖形上正確輸出如下帳戶信息:
            ?
            持倉:HOLDING,LINETHICK0;
            資產:ASSET,NOAXIS;
            可用現金:CASH(0),LINETHICK0;
            ?
            您可以在查看菜單->交易系統模板 中設置自己需要的模板
            }

            {別忘了將本網告訴您身邊的朋友,向朋友傳達有用資料,也是一種人情,你朋友會感謝你的。}

            ?

             

            有思路,想編寫各種指標公式,交易模型,選股公式,還原公式的朋友

            可聯系技術人員 QQ: 262069696  點擊在線交流或微信:cxhjy888 進行 有償收費 編寫!(注:由于人數限制,QQ或微信請選擇方便的一個聯系我們就行,加好友時請簡單備注下您的需求,否則無法通過。謝謝您!)

            怎么收費,代編流程等詳情請點擊查閱!

            (注:由于人數限制,QQ或微信請選擇方便的一個聯系我們就行,加好友時請簡單備注下您的需求,否則無法通過。謝謝您!)

             


            【字體: 】【打印文章】【查看評論

            相關文章

              沒有相關內容
              男男乱J伦高H小说

                <ins id="d3tjn"><th id="d3tjn"><delect id="d3tjn"></delect></th></ins>

                  <strike id="d3tjn"><span id="d3tjn"><ol id="d3tjn"></ol></span></strike>

                  <output id="d3tjn"></output>