The purpose of this script is to trade with the trend, trade trend continuation, and counter-trend trades.
Uptrend is price above 200 ema: Background is green and the bar colors are normal
Downtrend is price below 200 ema: Background is red and the bar colors are normal
Counter-trend to uptrend--Bar colors are white and the background is purple
counter-trend to downtrend--Bar colors are black and the background is aqua.
How to use:
Uptrend (green background): Only go long
Downtrend (red background): only go short
Counter-trend to uptrend/downtrend (white bars/black bars): Take counter-trend trade when price is a substantial distance from the 200 EMA. Best if there was a divergence with an oscillator. A lot of times these are just deep pullbacks or rallies.
trend continuation: In uptrend, after falling knives, and trend continues up (background turns to green) look to buy, you are getting a great price on the asset. Same for downtrend.
Keep in mind that nothing is perfect, and to of-course test everything.