Modifier le taux de multiplication de l'emplacement de Martin Geldof

Auteur:Z3192, Date: 2022-04-10 11:57:49 Je suis désolé
Les étiquettes:

Je suis très heureux de vous faire part de mon expérience avec ce jeu, mais je ne suis pas sûr que vous ayez une idée précise de ce qu'il est possible de faire avec ce jeu. Je suis désolée pour vous. Il n'y a pas de quoi. Le principe est de doubler vos pertes jusqu'à ce que vous gagniez le gain attendu. Le prix du disque n'a pas fonctionné, car il est utilisé pour la réévaluation.


/*backtest
start: 2017-06-26 00:00:00
end: 2022-02-16 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
var m =LongAmount //初始下单数
var n = ShortAmount //初始下单数
var MarginLevel1 =MarginLevel  //合约杠杆
var SetContractType1=SetContractType // 合约类型
var longprofit = profit //期望收益 ,多单不能小于手续费
var shortprofits = profits//期望收益 ,空单不能小于手续费
var longbet1 =longbet //开多倍率
var shortbet2=shortbet //开空倍率
StopProfit /=StopProfit ;
StopLoss /=StopLoss ;
//取随机数 
function sum(m, n) {  
    var num = Math.floor(Math.random() * (m - n) + n);  
    return num;
}

function main(){
    while(true){
LogProfit(exchange.GetAccount().Balance)
        Sleep(2000)
    }
}
function main() {
    exchange.SetContractType(SetContractType1)
    exchange.SetMarginLevel(MarginLevel1)
    var position = []
    while (true) { 
         position = exchange.GetPosition()
        if (position.length == 0) {
            //取随机数0、1作为方向
            var redom = sum(2, 0)
            Log(redom)
            redom=0==short //做空
            if (redom == 0) {
                n=ShortAmount
                exchange.SetDirection("sell")
                exchange.Sell(-1, n, "开空")
            }
            redom=1==long //做多
            if (redom == 1) {
                m=LongAmount
                exchange.SetDirection("buy")
                exchange.Buy(-1, m, "开多")
            }
        }
        if (position.length > 0) {

            if (position[0].Type == 0) {
                //多头盈利大于期望 
                if (position[0].Profit >profit) {
                    exchange.SetDirection("closebuy")
                    exchange.Sell(-1, position[0].Amount)
                    let redom = Math.random()
                    if (redom < 0.5) { 
                     m=LongAmount
                    exchange.SetDirection("buy")
                    exchange.Buy(-1, m, "平多头开多头头寸")    
                }
             }  
                //多头负盈利大于保证金 则加仓

                if (position[0].Profit <position[0].Margin * -1) {
                    longbet1=longbet
                    m=m*longbet
                    exchange.SetDirection("buy")
                    exchange.Buy(-1, position[0].Amount=m)
               }
            }
                  //空头盈利大于期望 
            if (position[0].Type == 1) {
                if (position[0].Profit > profits) {
                    exchange.SetDirection("closesell")
                    exchange.Buy(-1, position[0].Amount)
                    let redom = Math.random()
                   if (redom > 0.5) {  
                     n=ShortAmount
                    exchange.SetDirection("sell")
                    exchange.Sell(-1, n, "平空头开空头头寸")  
              }
          }
                  //空头负盈利大于保证金 则加仓
                if (position[0].Profit <position[0].Margin * -1 ) {
                    shortbet2=shortbet
                    n=n*shortbet
                    exchange.SetDirection("sell")
                    exchange.Sell(-1, position[0].Amount=n)
                }
            }
            Sleep(60000)
        }
    }
}



Plus de

745098522Comment calculer les gains attendus?