def action(): if getTrend()>O && checkMin(): buy(0.01) else if getTrend()<0 && checkMax(): sell(0.01) Timer(300, action, ()).start()