boll+maboll

Auteur:3 cochons, Date: 2019-05-04 11:41:27 Les résultats ont été diffusés par le site officiel de l'organisation.
Les étiquettes:

Une stratégie combinée de rupture et de retrait de la ceinture de fer Signaux d'ouverture: Forcelle à ligne droite sur le train de Bryn, amplification de la largeur du train de Bryn, montée du train de Bryn, plus ouverture; vice versa Signal de mise en place: la bande de brins est étroite, la ligne de chemin de fer est uniforme Signal de retour: la bande de Brin est en retraite

Le signal est encore dans le filtre.


import numpy as np
import talib
import time
if period == 1:
	per = PERIOD_M1
if period == 2:
	per = PERIOD_M3
if period == 3:
	per = PERIOD_M5
if period == 4:
	per = PERIOD_M15
if period == 5:
	per = PERIOD_M30
if period == 6:
	per = PERIOD_H1
	
status=0 #多:1  空:2

position = 0

def ontick():
	global position
	records = exchange.GetRecords(per)
	#------------指标计算---------
	#rsi = TA.RSI(records,14)
	#if rsi[-1] > 65 or rsi[-1] < 35:
	#    return
	bb = talib.BBANDS(records.Close,timeperiod=bo, nbdevup=2, nbdevdn=2, matype=0) #计算BB
	rsi = talib.RSI(records.Close,timeperiod=12)
	cmi = talib.CMO(records.Close,timeperiod=12)
	print(cmi[-1])
	move = talib.SMA(records.Close,ma2)#收盘价ma
	mabt = talib.SMA(bb[0],ma)#上轨ma
	mabd = talib.SMA(bb[2],ma)#下跪ma
	account = exchange.GetAccount()

	

	if bb[0][-1] > mabt[-1] and bb[0][-2] < mabt[-2] and bb[2][-1] < bb[2][-2] and bb[1][-1] > bb[1][-2] and records.Close[-1] > move[-1] and rsi[-1]>60:
		position += 1
		exchange.Buy(-1,account.Balance*0.1)
		#log('向上突破开多 '+ str(close[-1]))
	
	if bb[2][-1] < mabd[-1] and bb[2][-2] > mabd[-2] and bb[0][-1] > bb[0][-2] and bb[1][-1] < bb[1][-2] and records.Close[-1] < move[-1] and rsi[-1]<40:
		position -= 1
		exchange.Sell(-1,account.Stocks*0.1)
		#log('向下突破开空 '+ str(close[-1]))
	
	if bb[0][-1]-bb[2][-1] < bb[0][-2]-bb[2][-2]:
		if bb[0][-1] < mabt[-1] and bb[0][-2] > mabt[-2] and position> 0:
			position -= 1
			exchange.Sell(-1,account.Stocks*0.1)
			#log('多单平仓 '+ str(close[-1]))

		if bb[2][-1] > mabd[-1] and bb[2][-2] < mabd[-2] and position < 0:
			position += 1
			exchange.Buy(-1,account.Balance*0.1)
			#log('空单平仓 '+ str(close[-1]))

def main():
	while True:
		ontick()
		Sleep(30000)

Plus de