Credit to Zoen Triste for his original script at I just amend it for the 4H time frame. The main function is for dynamic support and resistance when day trading using smaller time frames such as 15mins so that we don't have to juggle between 4H and 15min time frames to see where is the EMA21 at 4H for the moment.