- Platform
-
- Thinkorswim
Thinkorswim is missing custom coloring of background for extended sessions. Here is a simple indicator that places a cloud over the extended session to mimic the result.
Code:
# Pre/Post Market Background Color for b4indicators.com
# Free for use. Header credits must be included when any form of the code included in this package is used.
DefineGlobalColor("ExtendedSession", Color.DARK_GRAY);
DefineGlobalColor("RegularSession", Color.BLACK);
input ShadeExtendedSession = yes;
input ShadeRegularTradingSession = no;
def isRTH = GetTime() <= RegularTradingEnd(GetYYYYMMDD()) and GetTime() >= RegularTradingStart(GetYYYYMMDD());
AddCloud(
if ShadeRegularTradingSession and isRTH then Double.POSITIVE_INFINITY else Double.NaN,
if ShadeRegularTradingSession and isRTH then Double.NEGATIVE_INFINITY else Double.NaN,
GlobalColor("RegularSession"), GlobalColor("RegularSession")
);
AddCloud(
if ShadeExtendedSession and !isRTH then Double.POSITIVE_INFINITY else Double.NaN,
if ShadeExtendedSession and !isRTH then Double.NEGATIVE_INFINITY else Double.NaN,
GlobalColor("ExtendedSession"), GlobalColor("ExtendedSession")
);