Type/to search
3
Follow
1
Followers
Problemas con el uso de la biblioteca de comercio de divisas digitales (los futuros admiten futuros de OKCoin/BitVC y admiten la función $.CTA)
FAQ
Created 2018-03-05 08:18:00  
 4
 2114

El uso directo de la biblioteca de clases de transacciones de monedas digitales (futuros con soporte para OKCoin / BitVC, soporte para la función $.CTA) para realizar pruebas, sin hacer ningún cambio. El resultado es not set contracttype ht

Pero el código está configurado
function main() {
if (exchange.GetName() === 'Futures_OKCoin') {
var info = exchange.SetContractType("this_week");

No sé por qué tengo este problema, pero también lo tengo cuando escribo otras estrategias.

img

Related Recommendations
Comment
All comments (4)

    明白您的问题了,您是直接 回测这个 模板了吧。
    这个模板的测试 代码 main 函数:

    // 测试代码 /* 2017.5.1 - 2017.10.11 , K线 天, 模拟级别, OK国际 , BTC */ function main() { $.CTA(exchanges[0], 0.01, function(r, mp, pair){ // $.CTA = function(Exchange, MinStock, onTick, interval) // Log(r.length) // 测试 if (r.length < 20) { return } var emaSlow = TA.EMA(r, 20) var emaFast = TA.EMA(r, 5) var cross = _Cross(emaFast, emaSlow); if (mp <= 0 && cross > 1) { Log(pair, "买, 金叉周期", cross, "mp:", mp); return 0.1 * (mp < 0 ? 2 : 1) } else if (mp >= 0 && cross < -1) { Log(pair, "卖, 死叉周期", cross, "mp:", mp); return -0.1 * (mp > 0 ? 2 : 1) } }) }

    是测试 $.CTA 函数的, $.CTA 函数是用于 现货交易所的, 您选择了 期货交易所 , 所以会报 没有设置 合约类型 这个错误。

    对于期货的用法是:

    var p = $.NewPositionManager() // this_week 即 当周合约 开多仓 , PositionManager.prototype.OpenLong = function(contractType, shares, price) exchange.SetContractType("this_week") p.OpenLong("this_week", 1, 1000) // 这样就 1000 美元价格 开多仓 合约 1张
    9 years ago

    谢谢,这下明白了!!

    9 years ago

    不客气 ^^

    9 years ago

    您具体怎么使用这个 模板的需要看下。
    贴下代码。

    9 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)