大中小 3サイクルジャンプ戦略 V2.0_ 現場_テスト

作者: リン・ハーン区分量化, 日付: 2019-12-07 17:52:33
タグ:

大中小3サイクルジャンプ戦略. 一般的には,大周期が市場方向を示し,中周期は現在の営業周期,小周期はトレンド停止信号を示します. 入社すると,大中小3サイクルの状態を見る限り,葛飾のように,複雑な市場に対応する多岐にわたる戦略を採用できます. 営業周期の頻度が1日数回であれば,大周期は日線を選択し,中周期は4時間,小周期は30分を選択できます. そして,それぞれの周期のK線と ブリン線の関係を列挙します. 合計8つの状態です.88=512状態,この512状態は,起こりうるすべての面に対応するのに十分であり,技術的に能力のあるプログラマは,各状態の最適な下位点位と停止点位を事前に設計することができる.皆が議論の基盤を持つために,区長も発明者プラットフォームで策略を公開しており,その基礎で改善することを歓迎します. 記録をダウンロードして分析します. これは発明者プラットフォームの利点です. 記録をダウンロードして分析します.img img
img分析すると,主な理由は以下の通りです. 1, 中小周期構造は比較的良いが,中小周期が中小周期にどのように影響するかを策略的に考えていない. 2 市場が空いているとき,ポジションを断固として捨てるべきだ 3日間線や5日間の均線は重要な指針であり,戦略的には反映されていない. 4 ブリンライン外の急落は売り切れる 5. 上向きな理由が落ちたとき,タイミングで停滞と損失を止める.img img何十回ものターゲティングの改善を経て,年化率は210になり,復旧率は16.4になり,取引数も減少した.


/*backtest
start: 2019-01-01 00:00:00
end: 2019-10-10 00:00:00
period: 1d
exchanges: [{"eid":"OKEX","currency":"ETH_USDT","stocks":0}]
args: [["OpMode",1,10989],["MaxAmount",1,10989],["TradeFee",0.001,10989]]
*/
//注册币乎后https://m.bihu.com/signup?i=1ewtKO&s=4&c=4
//搜索 物联网区块链 可以联系到作者区班主 你也可以给我写邮件tomjava@163.com
var midStatus = 0; //中周期状态
var bigStatus = 0; //大周期状态
var beforeBigStatus = 0; //之前大周期状态
var operPrice;
var markTime=0;

function mySell(rate){
   var account = _C(exchange.GetAccount);
   var ticker = _C(exchange.GetTicker);
   var nowPrice=ticker.Sell;
     
   //以下开始卖出
   var allAmount=account.Balance+account.Stocks*ticker.Sell; //计算出总金额
   var cashRatio=account.Balance*100/allAmount;
   
   if(cashRatio<90){  //现金比率小于10,才可以卖出
      if(rate==1){ //卖出1份
          if(cashRatio<80){
              $.Sell(allAmount*0.1/nowPrice);
              Log("现金比率",cashRatio+10);
          }else{
              $.Sell(allAmount*0.05/nowPrice);
              Log("现金比率",cashRatio+5);
          }
      }else{
          if(cashRatio<75){
              $.Sell(allAmount*0.2/nowPrice);
              Log("现金比率",cashRatio+20);
          }else{
              $.Sell(allAmount*0.1/nowPrice);
              Log("现金比率",cashRatio+10);
          }
      }
   }
}

function myBuy(rate){
   var account = _C(exchange.GetAccount);
   var ticker = _C(exchange.GetTicker);
   var nowPrice=ticker.Sell;
     
   //以下开始买入
   var allAmount=account.Balance+account.Stocks*ticker.Sell; //计算出总金额
   var cashRatio=account.Balance*100/allAmount;
   //Log("需要买入比率",rate);
   if(cashRatio>10){  //现金比率大于10,才可以买入
      if(rate==1){ //买入1份
          if(cashRatio>20){
              $.Buy(allAmount*0.1/nowPrice);
              Log("现金比率",cashRatio-10);
          }else{
              $.Buy(allAmount*0.05/nowPrice);
              Log("现金比率",cashRatio-5);
          }
      }else{
          if(cashRatio>25){
              $.Buy(allAmount*0.2/nowPrice);
              Log("现金比率",cashRatio-20);
          }else{
              $.Buy(allAmount*0.1/nowPrice);
              Log("现金比率",cashRatio-10);
          }
      }
   }
}

function oper(){
    var ticker = _C(exchange.GetTicker);
    var nowPrice=ticker.Sell;
   
    var h1records = exchange.GetRecords(PERIOD_H1);
    var h1boll;var h1upLine;var h1midLine;var h1downLine;
    var h1bw;
    if(h1records && h1records.length > 20) {
        h1boll = TA.BOLL(h1records, 20, 2);
        h1upLine = h1boll[0][h1records.length-1];
        h1midLine = h1boll[1][h1records.length-1];
        h1downLine = h1boll[2][h1records.length-1];
    }
    
    var drecords = exchange.GetRecords(PERIOD_D1);
    var dboll;var dupLine;var dmidLine;var ddownLine;
    var dbw;var beforePrice;
    if(drecords && drecords.length > 20) {
        dboll = TA.BOLL(drecords, 20, 2);
        dupLine = dboll[0][drecords.length-1];
        dmidLine = dboll[1][drecords.length-1];
        ddownLine = dboll[2][drecords.length-1];
        dbw=dupLine-dmidLine;
        beforePrice=(drecords[drecords.length-2].Open+drecords[drecords.length-2].Close)/2;
    }
    
    if(ticker.Time-markTime<15*60*1000){ //只有满足15分钟间隔,才允许判断状态
        return;
    }else{
        markTime=ticker.Time;
    }
    
    if(h1records && h1records.length > 20 && drecords && drecords.length > 20) {
        if(nowPrice>dupLine+dbw*0.1){
            bigStatus=0;
        }else if(nowPrice>dupLine-dbw*0.1){
            bigStatus=1;
        }else if(nowPrice>dmidLine+dbw*0.1){
            bigStatus=2;
        }else if(nowPrice>dmidLine){
            bigStatus=3;
        }else if(nowPrice>dmidLine-dbw*0.1){
            bigStatus=4;
        }else if(nowPrice>ddownLine+dbw*0.1){
            bigStatus=5;
        }else if(nowPrice>ddownLine-dbw*0.1){
            bigStatus=6;
        }else{
            bigStatus=7;
        }
        
        if(beforePrice>dupLine+dbw*0.1){
            beforeBigStatus=0;
        }else if(beforePrice>dupLine-dbw*0.1){
            beforeBigStatus=1;
        }else if(beforePrice>dmidLine+dbw*0.1){
            beforeBigStatus=2;
        }else if(beforePrice>dmidLine){
            beforeBigStatus=3;
        }else if(beforePrice>dmidLine-dbw*0.1){
            beforeBigStatus=4;
        }else if(beforePrice>ddownLine+dbw*0.1){
            beforeBigStatus=5;
        }else if(beforePrice>ddownLine-dbw*0.1){
            beforeBigStatus=6;
        }else{
            beforeBigStatus=7;
        }
        
        if(nowPrice>h1upLine+h1bw*0.1){
            midStatus=0;
        }else if(nowPrice>h1upLine-h1bw*0.1){
            midStatus=1;
        }else if(nowPrice>h1midLine+h1bw*0.1){
            midStatus=2;
        }else if(nowPrice>h1midLine){
            midStatus=3;
        }else if(nowPrice>h1midLine-h1bw*0.1){
            midStatus=4;
        }else if(nowPrice>h1downLine+h1bw*0.1){
            midStatus=5;
        }else if(nowPrice>h1downLine-h1bw*0.1){
            midStatus=6;
        }else{
            midStatus=7;
        }
        
        if(bigStatus-beforeBigStatus>0){ //当前有一个大周期下跌跃迁
            if(midStatus==6||midStatus==7){
                //Log("卖2份 当大",bigStatus,"前大",beforeBigStatus,"中",midStatus);
                //买2份
                mySell(2);
            }else if(midStatus==3||midStatus==4){
                //Log("卖1份 当大",bigStatus,"前大",beforeBigStatus,"中",midStatus);
                //买1份
                mySell(1);
            }else{
                //Log("当大",bigStatus,"前大",beforeBigStatus,"中",midStatus);
            }
        }else if(bigStatus-beforeBigStatus<0){  //当前有一个大周期上涨跃迁
            if(midStatus==6||midStatus==7){
                //Log("买2份 当大",bigStatus,"前大",beforeBigStatus,"中",midStatus);
                //买2份
                myBuy(2);
            }else if(midStatus==3||midStatus==4){
                //Log("买1份 当大",bigStatus,"前大",beforeBigStatus,"中",midStatus);
                //买1份
                myBuy(1);
            }else{
                //Log("当大",bigStatus,"前大",beforeBigStatus,"中",midStatus);
            }
        }else{
            //Log("当大",bigStatus,"前大",beforeBigStatus,"中",midStatus," dup",dupLine," 长度",dboll[0].length);
        }
    }
}

function main() {
    var initAccount = _C(exchange.GetAccount);
    Log(initAccount);
    exchange.SetCurrency("LTC_USDT")
    Log("BTC_USDT的计价币名称:", exchange.GetQuoteCurrency())
  
    while (true) {
        oper();
        Sleep(Interval*1000);
    }
}

もっと

ほら区長によるこのバージョンの戦略は,どのように最適化されているのでしょうか?

Jjkk平均的な周期は,

ハーワールド要求する

a410999923要求する

ロンリーマンこのコードは未改訂のコードです. 完璧なバージョンです.