Can someone please tell me if it's possible to convert strategy.entry order with a limit buy to an alert? Strategy seems to work much better with it so I want the alerts on TV to trigger at the specific limit entry but I can't figure it out.
//@version=4
study("Bottom Seeker Strategy", overlay=true)
// stop loss level with input options
longLossPerc = input(title="Long Stop Loss (%)",
type=input.float, minval=0.0, step=0.1, defval=0.2) * 0.01
// stop loss price
longStopPrice = strategy.position_avg_price * (1 - longLossPerc)
lengthLL = input(10)
lengthHH = input(40)
reverse = input(true, title="Trade reverse")
hh = highest(high, lengthHH)
ll = lowest(low, lengthLL)
pos = 0.0
pos := iff(close > hh[1], 1, iff(close < ll[1], -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1, iff(reverse and pos == -1, 1, pos))
// Orders (in strat format)
if (possig == 1)
strategy.entry("buy", true, limit=low[2], when=window())
if (possig == -1)
strategy.entry("sell", false, limit=high, when=window())
if (strategy.position_size > 0)
strategy.exit(id="XL STP", stop=longStopPrice)
I think i'd also need to adapt this line:
// stop loss price
longStopPrice = strategy.position_avg_price * (1 - longLossPerc)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.