Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 1.37 KB

30行赌徒策略.md

File metadata and controls

65 lines (48 loc) · 1.37 KB

Name

30行赌徒策略

Author

小小梦

Strategy Arguments

Argument Default Description
_StopWin 500 止盈
_StopLoss 500 止损
_FirstAmount 0.01 单次下单量
_MaxGear 8 加倍赌的次数

Source (javascript)

var hold = {price : 0, amount : 0}
var _Gear = 0
function main(){
    var initAccount = _C(exchange.GetAccount)
    Log(initAccount, "#FF0000")
    while(1){
        var ticker = _C(exchange.GetTicker)
        if(hold.amount == 0){
            var firstInfo = $.Buy(_FirstAmount)
            hold.amount = firstInfo.amount
            hold.price = firstInfo.price
        } else {
            if(ticker.Sell > hold.price + _StopWin){
                var coverStopWinInfo = $.Sell(hold.amount)
                hold.price = 0
                hold.amount = 0
                _Gear = 0
            } else if(ticker.Sell < hold.price - _StopLoss && _Gear < _MaxGear){
                $.Sell(hold.amount)
                var amount = hold.amount * 2
                var addInfo = $.Buy(amount)
                hold.price = addInfo.price
                hold.amount = addInfo.amount
                _Gear++
            }
        }
        LogStatus(_D(), "加倍下注次数:", _Gear, "\n", "当前持仓:", hold)
        Sleep(500)
    }
}

Detail

https://www.fmz.com/strategy/113796

Last Modified

2018-08-31 10:43:45