Type/to search

python版 Dual Thrust OKCoin 期货

Trend
8
Follow
1361
Followers

Dual Thrust 策略包含完整的图表显示, 图表动态更新,模板引用等功能, 可做学习模板使用.

Source
Python
import time
class Error_noSupport(BaseException):
    def __init__(self):
        Log("只支持OKCoin期货!#FF0000")

class Error_AtBeginHasPosition(BaseException):
    def __init__(self):
        Log("启动时有期货持仓! #FF0000")

ChartCfg = {
    '__isStock': True,
    'title': {
Strategy parameters
Strategy parameters
合约品种
杠杆大小
计算周期
上轨系数
下轨系数
开仓合约张数
重试间隔(毫秒)
轮询间隔(秒)
图表最大显示K线柱数
Comment
All comments (7)

    def onTick:
    ................
    if State == STATE_IDLE or State == STATE_SHORT:
    if Bar['Close'] >= UpTrack:
    msg = "做多,触发价:" + str(Bar['Close']) + "上轨" + str(UpTrack)
    Log(msg)
    Trade(State, STATE_LONG)
    State = STATE_LONG
    chart.add(1,{'x': Bar['Time'], 'color': 'red', 'shape': 'flag', 'title': '多', 'text': msg})
    如果订单未成交,这边state=state_long,改变了state的值,会不会对策略造成影响

    8 years ago

    应该不会 ,下的是 市价单, Trade 函数 检测到有持仓 才返回的。这个策略 逻辑是 移植 自 JS 版 OK期货 DT 策略的。

    8 years ago

    我想借用这个模板的图形功能,但图中上下轨的显示明显有问题

    9 years ago

    上下轨都变成一条直线了,大神能否修复一下

    9 years ago

    这个 策略 要使用 日周期的 K线 ,周期太小 不行。
    img

    9 years ago

    上下轨都变成一条线了,大神能否修复一下

    9 years ago

    你看我贴出的 ,是哪里有问题呢 ^^

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