// please help me with this strategy into alert indicator!!
//@version=5
strategy(title=’trail_points’, overlay=true, initial_capital=5000, default_qty_value=50)
rib_grp = ‘Moving Average Settings’
ma(source, length, type) => type == “SMA” ? ta.sma(source, length) : type == “EMA” ? ta.ema(source, length) : type == “SMMA (RMA)” ? ta.rma(source, length) : type == “WMA” ? ta.wma(source, length) : type == “VWMA” ? ta.vwma(source, length) : na
show_ma1 = input(true , “MA №0″, inline=”MA #0”, group=rib_grp)
ma1_type = input.string(“SMA” , “” , inline=”MA #0″, options=[“SMA”, “EMA”, “SMMA (RMA)”, “WMA”, “VWMA”], group=rib_grp)
ma1_source = input(low , “” , inline=”MA #0″, group=rib_grp)
ma1_length = input.int(34 , “” , inline=”MA #0″, minval=1, group=rib_grp)
ma1_color = input(#000000, “” , inline=”MA #0″, group=rib_grp)
ma1 = ma(ma1_source, ma1_length, ma1_type)
plot(show_ma1 ? ma1 : na, color = ma1_color, title=”MA №0″)
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
long_entry = ma1<close
long_exit = ta.crossover(ma1, close)
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ //
trail_p = input.int(defval=460, step=10)
trail_o = input.int(defval=0, step=10)
strategy.entry(‘long’, strategy.long, when=long_entry) //true
strategy.exit(‘TP’, ‘long’, trail_points=trail_p, trail_offset=trail_o)
strategy.close(‘long’, when=long_exit, comment=’close’)