DudeDastic
Member
Hi,
Here's some code I whipped up to mark the NY session macros using vertical lines. No bells and whistles.
Here's some code I whipped up to mark the NY session macros using vertical lines. No bells and whistles.
Code:
# ICT Macros
# Futures symbols from: https://www.reddit.com/r/thinkorswim/comments/iee7rv/using_futures_symbols_in_thinkscript/
declare upper;
input show_vertical_lines = yes;
def showem;
# regular futures symbols don't work in custom indicators, so use others from above link
if GetSymbol() == "SPX" {
showem = show_vertical_lines;
} else if GetSymbol() == "SPY" {
showem = show_vertical_lines;
} else if GetSymbol() == "/ES:XCME" {
showem = show_vertical_lines;
} else if GetSymbol() == "/MES:XCME" {
showem = show_vertical_lines;
} else if GetSymbol() == "QQQ" {
showem = show_vertical_lines;
} else if GetSymbol() == "/NQ:XCME" {
showem = show_vertical_lines;
} else if GetSymbol() == "/MNQ:XCME" {
showem = show_vertical_lines;
} else if GetSymbol() == "$DXY" {
showem = show_vertical_lines;
} else {
showem = !show_vertical_lines;
}
def start1 = 0950;
def end1 = 1010;
def first1 = if SecondsTillTime(start1) == 0 then 1 else 0;
def last1 = if SecondsFromTime(end1) == 0 then 1 else 0;
AddVerticalLine(showem and first1, " 9:50 Start ", Color.GREEN, Curve.MEDIUM_DASH);
AddVerticalLine(showem and last1, " 10:10 End ", Color.ORANGE, Curve.MEDIUM_DASH);
def start2 = 1050;
def end2 = 1110;
def first2 = if SecondsTillTime(start2) == 0 then 1 else 0;
def last2 = if SecondsFromTime(end2) == 0 then 1 else 0;
AddVerticalLine(showem and first2, " 10:50 Start ", Color.GREEN, Curve.MEDIUM_DASH);
AddVerticalLine(showem and last2, " 11:10 End ", Color.ORANGE, Curve.MEDIUM_DASH);
def start3 = 1150;
def end3 = 1210;
def first3 = if SecondsTillTime(start3) == 0 then 1 else 0;
def last3 = if SecondsFromTime(end3) == 0 then 1 else 0;
AddVerticalLine(showem and first3, " 11:50 Start ", Color.GREEN, Curve.MEDIUM_DASH);
AddVerticalLine(showem and last3, " 12:10 End ", Color.ORANGE, Curve.MEDIUM_DASH);
def start4 = 1310;
def end4 = 1340;
def first4 = if SecondsTillTime(start4) == 0 then 1 else 0;
def last4 = if SecondsFromTime(end4) == 0 then 1 else 0;
AddVerticalLine(showem and first4, " 1:10 Start ", Color.GREEN, Curve.MEDIUM_DASH);
AddVerticalLine(showem and last4, " 1:40 End ", Color.ORANGE, Curve.MEDIUM_DASH);
def start5 = 1515;
def end5 = 1545;
def first5 = if SecondsTillTime(start5) == 0 then 1 else 0;
def last5 = if SecondsFromTime(end5) == 0 then 1 else 0;
AddVerticalLine(showem and first5, " 3:15 Start ", Color.GREEN, Curve.MEDIUM_DASH);
AddVerticalLine(showem and last5, " 3:45 End ", Color.ORANGE, Curve.MEDIUM_DASH);
def sbstart = 1000;
def sbend = 1100;
def sbfirst = if SecondsTillTime(sbstart) == 0 then 1 else 0;
def sblast = if SecondsFromTime(sbend) == 0 then 1 else 0;
AddVerticalLine(showem and sbfirst, " 10:00 SB Begin", Color.LIGHT_GRAY, Curve.FIRM);
AddVerticalLine(showem and sblast, " 11:00 SB End ", Color.LIGHT_GRAY, Curve.FIRM);