Time Based Crypto DayTrade Strategy
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © exlux99

//@version=5
strategy("Time Based Crypto DayTrade Strategy",overlay=true, pyramiding=1, initial_capital=1000000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, calc_on_order_fills=false, slippage=0, commission_type=strategy.commission.percent, commission_value=0.05)


atr= ta.atr(input(13))
atr2=ta.atr(input(7))
atr_filter = false
if(atr > atr2)
    atr_filter:=true 

monday=input.bool(false)
tuesday=input.bool(true)
wednesday=input.bool(false)
thursday=input.bool(true)
friday=input.bool(false)
saturday=input.bool(false)
sunday=input.bool(false)

hour_entry=input(1)
hour_exit=input(0)
if(monday)
    strategy.entry("long", strategy.long, when= hour==hour_entry and dayofweek==1 and atr_filter)
    strategy.close("long", when=  hour==hour_exit)

if(tuesday)
    strategy.entry("long", strategy.long, when= hour==hour_entry and dayofweek==2 and atr_filter)
    strategy.close("long", when= hour==hour_exit )

if(wednesday)
    strategy.entry("long", strategy.long, when= hour==hour_entry and dayofweek==3 and atr_filter)
    strategy.close("long", when= hour==hour_exit )

if(thursday)
    strategy.entry("long", strategy.long, when= hour==hour_entry and dayofweek==4 and atr_filter)
    strategy.close("long", when= hour==hour_exit )

if(friday)
    strategy.entry("long", strategy.long, when= hour==hour_entry and dayofweek==5 and atr_filter)
    strategy.close("long", when= hour==hour_exit )

if(saturday)
    strategy.entry("long", strategy.long, when= hour==hour_entry and dayofweek==6 and atr_filter)
    strategy.close("long", when= hour==hour_exit )

if(sunday)
    strategy.entry("long", strategy.long, when= hour==hour_entry and dayofweek==7 and atr_filter)
    strategy.close("long", when= hour==hour_exit )