Tradingview Signal-Trading-Roboter Fehler und Lösungen

Schriftsteller:Nihao153159, Erstellt: 2021-01-02 07:06:59, Aktualisiert:

Neulinge wollen automatisch mit dem Trading View-Signal handeln. Btc dauerhafte Verträge, nach dem Roboter-Deployment erscheinen, Fehler Ct Vertrag als leer eingestellt. Der Code ist eine Kopie der TradingViewWebHook Signal-Exekutions-Strategien. - Ich weiß.

Die Parameter // var istMarketOrder = falsch // var QuotePrecision ist 2 // var Basispräzision = 2

// Futures-Parameter Das ist ein sehr schwieriges Problem.

// globale Variablen Var BUY = Käuferkäufer VAR SELL = VAR SELL Var LONG = Langen Var SHORT = Kurzschlag Var COVER_LONG = Cover_long ist ein VAR COVER_SHORT = VAR COVER_SHORT = VAR COVER_SHORT = VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT VAR COVER_SHORT Var SPK = SpK-Platin var BPK = bpk

Die Funktion ist hier: // Leere Logs können gelöscht werden, wenn sie nicht benötigt werden LogReset ((1)

// 设置精度
exchange.SetPrecision(QuotePrecision, BasePrecision)

// 识别期货还是现货
var eType = 0
var eName = exchange.GetName()
var patt = /Futures_/
if (patt.test(eName)) {
    Log("添加的交易所为期货交易所:", eName, "#FF0000")
    eType = 1
    if (Ct == "") {
        throw "Ct 合约设置为空"
    } else {
    	Log(exchange.SetContractType(Ct), "设置合约:", Ct, "#FF0000")
    }
} else {
	Log("添加的交易所为现货交易所:", eName, "#32CD32")
}

var lastMsg = ""
var acc = _C(exchange.GetAccount)
while(true) {
    var cmd = GetCommand()
    if (cmd) {
        // 检测交互命令
        lastMsg = "命令:" + cmd + "时间:" + _D()
        var arr = cmd.split(":")
        if (arr.length != 2) {
            Log("cmd信息有误:", cmd, "#FF0000")
            continue
        }

        var action = arr[0]
        var amount = parseFloat(arr[1])

        if (eType == 0) {
            if (action == BUY) {               
                var buyInfo = IsMarketOrder ? exchange.Buy(-1, amount) : $.Buy(amount)
                Log("buyInfo:", buyInfo)
            } else if (action == SELL) {        
                var sellInfo = IsMarketOrder ? exchange.Sell(-1, amount) : $.Sell(amount)
                Log("sellInfo:", sellInfo)
            } else {
            	Log("现货交易所不支持!", "#FF0000")
            }
        } else if (eType == 1) {
        	var tradeInfo = null
        	var ticker = _C(exchange.GetTicker)
            if (action == LONG) {
            	exchange.SetDirection("buy")
                tradeInfo = IsMarketOrder ? exchange.Buy(-1, amount) : exchange.Buy(ticker.Sell, amount)
            } else if (action == SHORT) {        
                exchange.SetDirection("sell")
                tradeInfo = IsMarketOrder ? exchange.Sell(-1, amount) : exchange.Sell(ticker.Buy, amount)
            } else if (action == COVER_LONG) {        
                exchange.SetDirection("closebuy")
                tradeInfo = IsMarketOrder ? exchange.Sell(-1, amount) : exchange.Sell(ticker.Buy, amount)
            } else if (action == COVER_SHORT) {        
            	exchange.SetDirection("closesell")
            	tradeInfo = IsMarketOrder ? exchange.Buy(-1, amount) : exchange.Buy(ticker.Sell, amount)
            } else if (action == SPK) {   // 卖出平多仓,卖出开空仓
                exchange.SetDirection("closebuy")
                var tradeInfo1 = IsMarketOrder ? exchange.Sell(-1, amount) : exchange.Sell(ticker.Buy, amount)
                exchange.SetDirection("sell")
                var tradeInfo2 = IsMarketOrder ? exchange.Sell(-1, amount) : exchange.Sell(ticker.Buy, amount)
                tradeInfo = [tradeInfo1, tradeInfo2]
            } else if (action == BPK) {   // 买入平空仓,买入开多仓
                exchange.SetDirection("closesell")
                var tradeInfo1 = IsMarketOrder ? exchange.Buy(-1, amount) : exchange.Buy(ticker.Sell, amount)
                exchange.SetDirection("buy")
                var tradeInfo2 = IsMarketOrder ? exchange.Buy(-1, amount) : exchange.Buy(ticker.Sell, amount)
                tradeInfo = [tradeInfo1, tradeInfo2]
            } else {
            	Log("期货交易所不支持!", "#FF0000")
            }
            if (tradeInfo) {
                Log("tradeInfo:", tradeInfo)
            }
        } else {
        	throw "eType error, eType:" + eType
        }
        acc = _C(exchange.GetAccount)
    }
    var tbl = {
    	type : "table", 
    	title : "状态信息", 
    	cols : ["数据"], 
    	rows : []
    }
    tbl.rows.push([JSON.stringify(acc)])
    LogStatus(_D(), eName, "上次接收到的命令:", lastMsg, "\n", "`" + JSON.stringify(tbl) + "`")
	Sleep(1000)
}

}


Mehr

Der König des Hip Hop.Ich habe keine falschen Informationen, wie sieht es aus?

Nihao153159Neulinge, um zu lernen, wie man einen btcusdt-permanenten Vertrag einrichtet und welche Codezeilen geändert werden sollen

Nihao153159Der Spotbot ist vollständig auf die B-Station Video eingestellt und funktioniert nicht, buynull kehrt sellnull zurück, nachdem der Transaktionsbefehl erhalten wurde.

Das GrasNicht ausreichend Geld

Nihao153159Der Fehler der Futures-Roboter ist: 2021-01-02 23:40:08 Informationen Futures-Börsen werden nicht unterstützt! 2021-01-02 23:40:05 Informationen Futures-Börsen werden nicht unterstützt! 2021-01-02 23:38:23 Informationen {"InstrumentID:"BTCUSDT","instrument:"BTCUSDT"} Einrichtung des Vertrags: swap 2021-01-02 23:38:23 Informationen für die Futures-Börse: Futures_Binance Ich habe keine Sorgen mehr.

Nihao153159Datum Plattform Typ Preis Menge Informationen 2021-01-02 23:39:01 Informationen sellInfo: null 2021-01-02 23:39:01 Binance Fehler Sell ((-1, 0.01): 400: {"code":-2010, "msg:"Account has insufficient balance for requested action"} 2021-01-02 23:38:53 Informationen buyInfo: null 2021-01-02 23:38:53 Binance Fehler Buy ((-1, 0.01): 400: {"code":-2010, "msg:"Account has insufficient balance for requested action"}