小編這次要給大家分享的是用代碼實(shí)例解析python瀑布線指標(biāo),文章內(nèi)容豐富,感興趣的小伙伴可以來(lái)了解一下,希望大家閱讀完這篇文章之后能夠有所收獲。

我就廢話不多說(shuō)了,大家還是直接看代碼吧!
# -*- coding: utf-8 -*-
"""
Created on Tue May 23 08:57:02 2017
@author: yunjinqi
E-mail:yunjinqi@qq.com
Differentiate yourself in the world from anyone else.
"""
import pandas as pd
import numpy as np
import datetime
import time
#獲取數(shù)據(jù)
df=pd.read_csv('C:/Users/HXWD/Desktop/000001.csv',encoding='gbk')
df.columns=['date','code','name','close','high','low','open','preclose',
'change','change_per','volume','amt']
df=df[['date','open','high','low','close','volume','amt']]
df.head()
def get_EMA(df,N):
for i in range(len(df)):
if i==0:
df.ix[i,'ema']=df.ix[i,'close']
if i>0:
df.ix[i,'ema']=(2*df.ix[i-1,'close']+(N-1)*df.ix[i,'close'])/(N+1)
return df['ema']
def get_PBX(df):
df['a1']=(get_EMA(df,4)+df['close'].rolling(8).mean()+
df['close'].rolling(16).mean())/3
df['a2']=(get_EMA(df,6)+df['close'].rolling(12).mean()+
df['close'].rolling(24).mean())/3
df['a3']=(get_EMA(df,9)+df['close'].rolling(18).mean()+
df['close'].rolling(36).mean())/3
df['a4']=(get_EMA(df,13)+df['close'].rolling(26).mean()+
df['close'].rolling(52).mean())/3
df['a5']=(get_EMA(df,18)+df['close'].rolling(36).mean()+
df['close'].rolling(72).mean())/3
df['a6']=(get_EMA(df,24)+df['close'].rolling(48).mean()+
df['close'].rolling(96).mean())/3
return df
get_PBX(df)
df.tail()
'''
瀑布線
原理:均線類指標(biāo)
用法:
瀑布線是趨勢(shì)性指標(biāo),因其在運(yùn)行的過(guò)程中,形態(tài)與瀑布極其相似,故得名為瀑布線。
瀑布線在低位粘合,短線瀑布線向上穿越長(zhǎng)線瀑布線并向上發(fā)散,買入。
瀑布線在高位粘合,短線瀑布線向下穿越長(zhǎng)線瀑布線并向下發(fā)散,賣出。
當(dāng)長(zhǎng)中短期瀑布線依次由下向上排列形成多頭排列時(shí),可持股。
當(dāng)長(zhǎng)中短期瀑布線依次由上向下排列形成空頭排列時(shí),應(yīng)空倉(cāng)。
'''
文章題目:用代碼實(shí)例解析python瀑布線指標(biāo)-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)路徑:http://www.js-pz168.com/article46/gheeg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、微信小程序、網(wǎng)站設(shè)計(jì)公司、品牌網(wǎng)站建設(shè)、軟件開(kāi)發(fā)、網(wǎng)站改版
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容