Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- // Created by Leon Ross
- strategy(title = "SmashDay", shorttitle = "SD", overlay = true,
- pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 100,
- calc_on_every_tick=false, initial_capital=100000)
- //Window of time
- start = timestamp(2018, 08, 01, 00, 00) // backtest start window
- finish = timestamp(2018, 12, 31, 23, 59) // backtest finish window
- window() => time >= start and time <= finish ? true : false // create function "within window of time"
- //Conditions
- closeBelowLow = close < low[1]
- highOnNextDay = valuewhen(closeBelowLow, high, 0)
- allConditions = closeBelowLow
- //Plots
- bgcolor(closeBelowLow ==1 ? lime : na, transp=70)
- plot(entry, color=blue, style=linebr, linewidth=2)
- //Entires/Exits
- if(window())
- if(close>highOnNextDay)
- //strategy.entry(id = "Long", long = true, when = entry) // use function or simple condition to decide when to get in
- //strategy.exit("Exit Long", from_entry = "Long", limit = useTakeProfit, stop = useStopLoss)
Add Comment
Please, Sign In to add comment