意味
現在のバーが緑色(クローズ>オープン)で、前のバーのクローズの上で開く場合、BarUpDnストラテジーはロングポジションに入ります。現在のバーが赤で、そのオープンが前のバーのクローズより下にある場合、それはショートに入ります。1日あたりの損失率がインジケーター設定で指定された数値を超えると、すべてのポジションがクローズされます。
結論
BarUpDn戦略は、特定のバーが緑で前のバーよりも高いか、赤で前のバーよりも低いかどうかに基づいています。戦略は、価格の迅速な変化を探し、それらの変化をトレードしようと試み、潜在的に上昇トレンドまたは下降トレンドの開始に飛び込むことです。BarUpDn戦略も比較的単純であり、Pine戦略に不慣れな人のための教育の出発点として使用できます。
#strategy(title, shorttitle, overlay, format, 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, process_orders_on_close, close_entries_rule, margin_long, margin_short, explicit_plot_zorder, max_lines_count, max_labels_count, max_boxes_count, risk_free_rate, use_bar_magnifier)
//@version=5
strategy("BarUpDn Strategy", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 10)
#strategy.percent_of_equity
maxIdLossPcnt = input.float(1, "Max Intraday Loss(%)")
strategy.risk.max_intraday_loss(maxIdLossPcnt, strategy.percent_of_equity)
#strategy.risk.max_intraday_loss
if (close > open and open > close[1])
strategy.entry("BarUp", strategy.long)
if (close < open and open < close[1])
strategy.entry("BarDn", strategy.short)
#strategy.entry
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
#plot