Hanya melakukan set pertama, set kedua boleh diubah, kontrak digantikan, iaitu set kedua.
Tambah dua objek pertukaran, suku pertama, minggu kedua.
Semua kod yang boleh disederhanakan telah disederhanakan, ruang untuk mengoptimumkan masih banyak, strategi pengajaran berhati-hati, dan jangka masa yang panjang mempunyai risiko.
Selamat datang untuk maklum balas BUG.
function Hedge (isOpen, priceA, priceB) { exchanges[0].SetDirection(isOpen ? "sell" : "closesell") exchanges[1].SetDirection(isOpen ? "buy" : "closebuy"); (function (routineA, routineB) { Log(routineA.wait(), routineB.wait(), priceA, priceB) })(exchanges[0].Go(isOpen ? "Sell" : "Buy", priceA, _ContractNum), exchanges[1].Go(isOpen ? "Buy" : "Sell", priceB, _ContractNum)); } var slidePrice = 5 function main () { var tickerA, tickerB var arr = [] for (var i = 0 ; i < _Count ; i++) { arr.push({open: _Begin + i * _Add, cover: _Begin + i * _Add - _Profit, isHold: false}) } exchanges[0].SetContractType("quarter") exchanges[1].SetContractType("this_week") while (1) { var tab = {type: "table", title: "状态", cols: ["节点信息"], rows: []} tickerA = exchanges[0].GetTicker() tickerB = exchanges[1].GetTicker() if (tickerA && tickerB) { $.PlotLine("差价:A所-B所", tickerA.Last - tickerB.Last) for (var j = 0 ; j < arr.length; j++) { if (tickerA.Buy - tickerB.Sell > arr[j].open && !arr[j].isHold) { Hedge(true, tickerA.Buy - slidePrice, tickerB.Sell + slidePrice) arr[j].isHold = true } if (tickerA.Sell - tickerB.Buy < arr[j].cover && arr[j].isHold) { Hedge(false, tickerA.Sell + slidePrice, tickerB.Buy - slidePrice) arr[j].isHold = false } tab.rows.push([JSON.stringify(arr[j])]) } } LogStatus(_D(), "\n `" + JSON.stringify(tab) + "`") Sleep(500) } }
Cinta Jimmy.exchanges[0].Go() tidak dijelaskan dalam dokumentasi fungsi ini?
Tahun 1998Hai penulis, adakah strategi ini masih berfungsi?
FmzeroDi mana video pengajaran?
Cinta Jimmy.Oh, terima kasih, saya lihat, saya belajar.
Mimpi kecilDi sini, anda boleh melihat apa yang terdapat dalam dokumen API: https://www.fmz.com/api#exchange.go...
Mimpi kecilStrategi adalah strategi pengajaran, boleh diubah, diperluaskan, dioptimumkan sendiri.
Mimpi kecilSumbernya sangat mudah dan mudah difahami.