Как создать оповещение в стратегии в pine-script? Существует стратегия, которая показывает точки входа со стрелками, необходимо иметь возможность создавать оповещения, и это встроено в код с помощью функции alertcondition (если я правильно понял). Сам код:
//@version=3
strategy("Strategy", shorttitle="Strategy", overlay=false, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=5, commission_type=strategy.commission.percent, commission_value=0.2, pyramiding=0)
//Period
startY = input(title="Start Year", defval = 2011, type=integer)
startM = input(title="Start Month", defval = 1, type=integer, minval = 1, maxval = 12)
startD = input(title="Start Day", defval = 1, type=integer, minval = 1, maxval = 31)
finishY = input(title="Finish Year", defval = 2050, type=integer)
finishM = input(title="Finish Month", defval = 12, type=integer, minval = 1, maxval = 12)
finishD = input(title="Finish Day", defval = 31, type=integer, minval = 1, maxval = 31)
//finish = input(2019, 02, 28, 00, 00)
timestart = timestamp(startY, startM, startD, 00, 00)
timefinish = timestamp(finishY, finishM, finishD, 23, 59)
window = time >= timestart and time <= timefinish ? true : false // Lenghth strategy
length1 = input(21, minval=1), smoothK1 = input(3, minval=1), smoothD1 = input(3, minval=1)
//length2 = input(5, minval=1), smoothK2 = input(1, minval=1), smoothD2 = input(1, minval=1)
inh0 = input(title="Bottom Line", defval = 14, minval=0), inh1 = input(title="Upper Line", defval = 86, minval=0)
k1 = sma(stoch(close, high, low, length1), smoothK1)
d1 = sma(k1, smoothD1)
plot(k1, color=blue)
plot(d1, color=red)
//k2 = sma(stoch(close, high, low, length2), smoothK2)
//d2 = sma(k2, smoothD2)
//plot(k2, color=orange)
h1 = hline(inh1)
h0 = hline(inh0)
fill(h0, h1, color = aqua, transp=90)
//open
strategy.entry("LongEntryID", strategy.long, comment="LONG", when = crossover(k1, d1) and crossover(k1, inh0) and window)
strategy.entry("ShortEntryID", strategy.short, comment="SHORT", when = crossunder(k1, d1) and crossunder(k1, inh1) and window)
if crossunder(k1, d1) and crossunder(k1, inh1) and strategy.position_size > 0
strategy.close_all()
if crossover(k1, d1) and crossover(k1, inh0) and strategy.position_size < 0
strategy.close_all()
Вы можете порекомендовать, как создать оповещение?