見出し画像

Pine script ストラテジー作成 覚書

ストラテジー作成の時に必要な知識の覚書


ストラテジーのプロパティ

strategy(title, shorttitle, overlay, precision, 
         scale, pyramiding, calc_on_order_fills, calc_on_every_tick, 
         max_bars_back, backtest_fill_limits_assumption, default_qty_type, 
         default_qty_value, initial_capital, currency, slippage, 
         commission_type, commission_value)

pyramiding: 片方向にもてる最大保有建玉数(def = 0)
calc_on_order_fills: 通常の各バーの終値確定時ではなく、約定時にも処理が行われるようになる(def = false)
initial_capital: 初期資本
currency: 証拠金通貨
commision_type: strategy.commission.cash_per_order = 固定
          strategy.commission.percent = パーセント

注文設定

strategy.entry(id, long, qty, limit, stop, oca_name, 
               oca_type, comment, when)

id: 一意な名称を付ける
long:  strategy.long or true = long , strategy.short or false = short
qty: 注文サイズ
limit, stop: priceを指定して指値 or 逆指値を発注する
oca_name, oca_type: グループオーダー用。使わないから割愛
when: trueの時に発注する。boolを食わせる


バックテストで利用できるバーの数

無料ユーザーは5,000バー、有料ユーザーは10,000バーです(TradingView Wiki、2019年)


便利なビルトイン関数

strategy.position_avg_price: 平均取得単価
strategy.equity: 現在残高



この記事が気に入ったらサポートをしてみませんか?