// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0///@version=4strategy("My Strategy", overlay=true)start =timestamp(2019,1,1,00,00) // backtest start windowfinish =timestamp(2020,1,1,23,59) // backtest finish windowwindow() => time >= start and time <= finish ?true:false// create function "within window of time"sDay =7bDay =12calculate(x, y) =>ema(x, y)longCondition =crossover(calculate(close, sDay),calculate(close, bDay))if (longCondition)strategy.entry("My Long Entry Id",strategy.long, when =window())shortCondition =crossunder(calculate(close, sDay),calculate(close, bDay))if (shortCondition)strategy.entry("My Short Entry Id",strategy.short, when =window())
//Based on ChrisMoody's Forex Session Templates Based on EST-New York Time Zonestudy(title="Trading hours background highlight UTC based",shorttitle="Trading hours", overlay=true)timeinrange(res, sess) =>time(res, sess) !=0//Change true to false = You have to turn on, won't show up by default//****Always use lowercase lettersdoEurOpen =input(defval=true, type = bool, title="Euro Open On")//You can copy and paste these colors. white - silver - gray - maroon - red - purple - fuchsia - green - lime// olive - yellow - navy - blue - teal - aqua - orange europeSessionStart = #1E90FFbgcolor(doEurOpen and timeinrange(period,"2200-0010") ? europeSessionStart : na, transp=60)