Guest User

Untitled

a guest
Dec 16th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. //@version=3
  2. // Created by Leon Ross
  3. strategy(title = "SmashDay", shorttitle = "SD", overlay = true,
  4. pyramiding = 0, default_qty_type = strategy.percent_of_equity, default_qty_value = 100,
  5. calc_on_every_tick=false, initial_capital=100000)
  6.  
  7.  
  8. //Window of time
  9. start = timestamp(2018, 08, 01, 00, 00) // backtest start window
  10. finish = timestamp(2018, 12, 31, 23, 59) // backtest finish window
  11. window() => time >= start and time <= finish ? true : false // create function "within window of time"
  12.  
  13. //Conditions
  14. closeBelowLow = close < low[1]
  15. highOnNextDay = valuewhen(closeBelowLow, high, 0)
  16. allConditions = closeBelowLow
  17.  
  18. //Plots
  19. bgcolor(closeBelowLow ==1 ? lime : na, transp=70)
  20. plot(entry, color=blue, style=linebr, linewidth=2)
  21.  
  22. //Entires/Exits
  23. if(window())
  24. if(close>highOnNextDay)
  25. //strategy.entry(id = "Long", long = true, when = entry) // use function or simple condition to decide when to get in
  26. //strategy.exit("Exit Long", from_entry = "Long", limit = useTakeProfit, stop = useStopLoss)
Add Comment
Please, Sign In to add comment