日内反T交易策略

centq
centq 量化爱好者

2 People liked this article · 1624 views

策略名称:单标的日内反T交易策略
运行周期:分钟
策略流程:
1. 根据 g.handle_data_flag = True 判断当是否可交易
2. 根据 g.ini_buy_flag = True 判断是否需要买底仓,生产环境手中已经有底仓时,可以设置为False
3. 参数 g.amount 为底仓及做T时的交易量
4. 参数 g.frequency 为参考macd 周期,1/5/15/30//60/120
5. 根据当日macd死叉信号,做空,macd金叉再做多,到14:55还是空仓时,恢复到底仓。

# 初始化此策略
def initialize(context):
# 设置我们要操作的股票池, 这里我们只操作一支股票
g.security = '600811.SS'        根据库存股票填写,深圳改后缀SZ
#1份标准交易头寸
g.amount = 500                    根据库存情况填写数量,一般库存50%为宜
# macd 获取频率 1 = 1m
g.frequency = 15                   15分钟分时线,可以修改
# macd 参数配置
g.macd_short = 6                   可以修改
g.macd_long = 13                  可以修改
g.macd_m = 5                        可以修改

以下程序请不要修改!


List of attachments

日内反T_v1.5.txt

6KB

399.00

积分

Published on 2025-01-04 18:53

Disclaimers:

This document is written by centq Original published on 百果量化交流平台 ,The copyright belongs to the author。

Log in,More exciting content waiting for you to find,Contribute wonderful answers,Participate in comment interaction

go Sign in! No accountgoregister