0bps

Strategy vault / Other

30 Line Gambler Strategy Short Selling

JavaScript strategy by 发明者量化-小小梦.

JavaScriptOther
Author
发明者量化-小小梦
Complexity
Starter · 30 lines
Parameters
4

The original spec has no written description. Read the source below.

Parameters

NameDefaultWhat it controls
_StopWin500take profit
_StopLoss500stop loss
_FirstAmount0.01Single order quantity
_MaxGear8Double the number of bets

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 = $.Sell(_FirstAmount)
            hold.amount = firstInfo.amount
            hold.price = firstInfo.price
        } else {
            if(ticker.Buy < hold.price - _StopWin){
                var coverStopWinInfo = $.Buy(hold.amount)
                hold.price = 0
                hold.amount = 0
                _Gear = 0
            } else if(ticker.Buy > hold.price + _StopLoss && _Gear < _MaxGear){
                $.Buy(hold.amount)
                var amount = hold.amount * 2
                var addInfo = $.Sell(amount)
                hold.price = addInfo.price
                hold.amount = addInfo.amount
                _Gear++
            }
        }
        LogStatus(_D(), "Number of doubling bets: ", _Gear, "\n", "Current position:", hold)
        Sleep(500)
    }
}

Published by 发明者量化-小小梦 on the FMZ strategy square · last modified 2018-08-29. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.

Build this with AgenKit

A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.

in Claude Code, Cursor, Codex & 4 more
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/30-Line-Gambler-Strategy-Short-Selling.md
  1. npx agenkit install engineering-kit in your project
  2. Paste the command into your agent and approve each phase
  3. Get tests, backtest, risk controls and a paper-trading switch

Understand it first

Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.

Related specs

esc

Try , , or .

↑↓ move↵ open