マガジンのカバー画像

スナフキンnote

43
運営しているクリエイター

#BTC

Trading View Pine: MACDバックテスト

Trading View の pineスクリプトでのMACDバックテストの書き方です。
ゴールデンクロスで買い、デッドクロスで売る、simpleなロジックです。

//@version=3strategy("MACD Strategy", overlay=false)[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)plot(macd

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ16

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

calculateLinesメソッドの続きから。def calculateLines(self, df_candleStick, term): """ 期間高値・安値を計算する. candleStickはcryptowatchのローソク足.termは安値,高値を計算する

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ18

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

# 直近約定件数30件の高値と安値 high = max([self.executions[-1 - i]["price"] for i in range(30)]) low = min([self.executi

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ19

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

# 現在レンジ相場かどうか. isRange = self.isRange(df_candleStick, rangeTerm, rangeTh)

isRangeメソッドを呼んでいます。

def isRange(self

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ20

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

calculatePriceRangeメソッドの続きから。

def calculatePriceRange(self, df_candleStick, term): """ termの期間の値幅を計算. """ low = [

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ21

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

isRangeメソッドの続きから。

def isRange(self, df_candleStick, term, th): """ レンジ相場かどうかをTrue,Falseの配列で返す.termは期間高値・安値の計算期間. th

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ26

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

describePLForNotificationメソッドの続きから。

def describePLForNotification(self, pl, df_candleStick): import matplotlib matplotlib.us

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ27

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

describePLForNotificationメソッドの続きから。

def describePLForNotification(self, pl, df_candleStick): import matplotlib matplotlib.use('

もっとみる

チャネルブレイクアウトbotコード(by スナフキン氏)読解メモ29

の続きです。
題材コードは https://sshuhei.com/entry/channelbreakout/ です。

バックテストを読んでいきます。

# バックテスト channelBreakOut.describeResult(entryTerm=channelBreakOut.entryTerm, close

もっとみる