python
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © dwyh8581
//@version=6
indicator(title="2 MA Cross Using High&Low", overlay=true, timeframe="", timeframe_gaps=true)
shortlen = input.int(9, "Short MA Length", minval=1)
longlen = input.int(21, "Long MA Length", minval=1)
short = ta.sma(low, shortlen)
long = ta.sma(high, longlen)
plot(short, color = #FF6D00, display = display.pane)
plot(long, color = #43A047, display = display.pane)
buy = ta.crossover(short, long)
sell = ta.crossunder(short, long)
signal = buy ? 1 : sell ? -1 : na
plotshape(buy, '', shape.labelup, location.belowbar, color.green, 0, 'BUY', color.black, display = display.pane)
plotshape(sell, '', shape.labeldown, location.abovebar, color.red, 0, 'SELL', color.black, display = display.pane)
plot(signal, 'Signal', display = display.data_window)
无它,纯瞎写。最近琢磨日内交易的投机取巧,改了一个别人常规用的MA close。回测看了下个别交易对,再配合前置的几个成交量柱子,还是凑合的。其他没法说太多。再进一步可以配信号机器人,但不是忙疯的话,还是手工单来的稳。另外一定记得带止损。
