I am trying to run this script on Pinescript in Trading View. However, when I try to add in timestamp, it does not work. Can someone help with this?
//@version=4
strategy("My Strategy", overlay=true)
start = timestamp(2007, 1, 1, 0, 0)
end = timestamp(2009, 3, 31, 0, 0)
// Indicators
SMA50 = sma(close, 50)
SMA100 = sma(close, 100)
rsi = rsi(close, 14)
atr = atr(14)
// Crossover conditions
longCondition = crossover(SMA50, SMA100)
if (longCondition)
stopLoss = low - atr * 2
takeProfit = high + atr * 6
strategy.entry("long", strategy.long, 100, when = rsi > 30)
strategy.exit ("exit", "long", stop=stopLoss, limit=takeProfit)
// Plotting SMAs in the chart.
plot(SMA50)
plot(SMA100,color=color.black)