I'm writing a backtesting strategy to buy at certain time every day above that day's high so far.
I've written a pinescript strategy. See below. I've restricted it to August month of this year. This is applied on a 5m chart.
//@version=4
strategy("bnf2")
entryTime = year == 2019 and month == 8 and hour == 14 and minute == 0
exitTime = year == 2019 and month == 8 and hour == 15 and minute == 15
strategy.entry("bnf-long", strategy.long, 20, stop= high, when=entryTime)
strategy.close("bnf-long", when = exitTime)
plot(strategy.equity)
I suspect the "stop = high" is causing an issue as the high is not defined as that day's high so far.
What change do I need to make to the script to achieve this?