等级: 新手上路
- 注册:
- 2024-7-10
- 曾用名:
|
#低位出现多信号时。
if before_ho1<=0 and ho1>0 and tsellho>0:
buy_close(code, "Limit", price=nxzd,volume =tsellho,serial_id = 1) # 用卖NXZD价平空
if before_ho1<=0 and ho1>0 and tbuyho==0:
buy_open(code, "Limit", price=nxzd,volume =ivol,serial_id = 2) # 用买NXZD价开多
#高位出现空信号时。
if before_ho1>=0 and ho1<0 and tbuyho>0:
sell_close(code, "Limit", price=nxzk,volume =tbuyho,serial_id = 3) # 用买NXZK价平多
if before_ho1>=0 and ho1<0 and tsellho==0:
sell_open(code, "Limit", price=nxzk,volume =ivol ,serial_id = 4) # 用卖NXZK开空
#自动同步部分,做多。
if before_ho1>0 and ho1>0 and tsellho>0:
buy_close(code, "Limit", price=nxzd,volume =tsellho,serial_id = 5) # 用卖"Market"价平空
if before_ho1>0 and ho1>0 and tbuyho==0:
buy_open(code, "Limit", price=nxzd,volume =ivol,serial_id = 6) # 用买"Market"价开多 补仓
if before_ho1>0 and ho1>0 and tbuyho>ho1:
buy_open(code, "Limit", price=nxzd,volume =tbuyho-ho1,serial_id = 7) # 用买"Market"价开多 减仓
#自动同步部分,做空。
if before_ho1<0 and ho1<0 and tbuyho>0:
sell_close(code, "Limit", price=nxzk,volume =tbuyho,serial_id = 8) # 用买"Market"价平多
if before_ho1<0 and ho1<0 and tsellho==0:
sell_open(code, "Limit", price=nxzk,volume =ivol ,serial_id = 9) # 用卖"Market"价开空 补仓
if before_ho1<0 and ho1<0 and tsellho>abs(before_ho1):
sell_open(code, "Limit", price=nxzk,volume =tsellho-abs(before_ho1),serial_id = 10) # 用卖"Market"价开空 减仓
|
|