I am writing a simple pine script to go Long before 10 mins hourly candle closure and close short after 10 mins after candle closure.
But the script does not apply to previous date / time but only applied from the time I add it to the chart.
I would like to back testing of this simple strategy. Can some one help please?
I am very new to scripting. Appreciate any help.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © jayaguru
//@version=4
strategy("My Strategy", overlay=true)
longCondition = minute(timenow)
if (longCondition == 55)
strategy.entry("Long", strategy.long, comment="Long")
if (longCondition == 14 or strategy.openprofit < -15 or strategy.openprofit > 40)
strategy.close_all()