What is quantitative trading?
Quantitative trading refers to using quantitative methods to formulate action plans and conduct transactions.During the trading process,advanced mathematical models are used to quantify market data,replacing artificial subjective judgments,and historical data are repeatedly verified to find"high
probability"strategies that can continue to make profits in the future.Computer rapid processing technology is used to greatly reduce the impact of investor sentiment fluctuations,avoiding irrational investment decisions when the market is extremely fanatical or pessimistic.
12.MACD
def MACD(df,n_fast,n_slow):
EMAfast=Series(ewma(df['Close'],span=n_fast,min_periods=n_slow-1))
EMAslow=Series(ewma(df['Close'],span=n_slow,min_periods=n_slow-1))
MACD=Series(EMAfast-EMAslow,name='MACD_'+str(n_fast)+'_'+str(n_slow))
MACDsign=Series(ewma(MACD,span=9,min_periods=8),name='MACDsign_'+str(n_fast)+'_'+str(n_slow))
MACDdiff=Series(MACD-MACDsign,name='MACDdiff_'+str(n_fast)+'_'+str(n_slow))
df=df.join(MACD)
df=df.join(MACDsign)
df=df.join(MACDdiff)
return df
13.梅斯线(高低价趋势反转)
def MassI(df):
Range=df['High']-df['Low']
EX1=ewma(Range,span=9,min_periods=8)
EX2=ewma(EX1,span=9,min_periods=8)
Mass=EX1/EX2
MassI=Series(rolling_sum(Mass,25),name='Mass Index')
df=df.join(MassI)
return df
14.涡旋指标
def Vortex(df,n):
i=0
TR=[0]
while i<df.index[-1]:
Range=max(df.get_value(i+1,'High'),df.get_value(i,'Close'))-min(df.get_value(i+1,'Low'),df.get_value(i,'Close'))
TR.append(Range)
i=i+1
i=0
VM=[0]
while i<df.index[-1]:
Range=abs(df.get_value(i+1,'High')-df.get_value(i,'Low'))-abs(df.get_value(i+1,'Low')-df.get_value(i,'High'))
VM.append(Range)
i=i+1