swaroop472
New member
Code:
#Option Hacker Scan for Active Call or Put Options on SPX
input optionType = {default "Call", "Put"};
input minOI = 500; #Minimum Open Interest
input minVolume = 500; #Minimum Volume
input minDelta = 0.5; #Minimum Delta
input minIV = 50; #Minimum Implied Volatility
def underlyingSymbol = "/ES"; #Change to SPX symbol
def exp = GetYYYYMMDD() + 1; #Set expiration date to tomorrow
def daysToExp = 1;
def strike = GetStrike();
def opt = if optionType == "Call" then
if GetOptionType() == OptionType.CALL then 1 else 0
else if optionType == "Put" then
if GetOptionType() == OptionType.PUT then 1 else 0
else 0;
def oi = GetOpenInterest();
def vol = GetVolume();
def delta = AbsValue(GetDelta());
def iv = GetIV();
def filter = oi >= minOI and vol >= minVolume and delta >= minDelta and iv >= minIV;
AddLabel(yes, "Option Type: " + optionType, Color.YELLOW);
AddLabel(yes, "Underlying: " + underlyingSymbol, Color.YELLOW);
AddLabel(yes, "Expiration: " + AsDateString(exp), Color.YELLOW);
AddLabel(yes, "Days to Expiration: " + daysToExp, Color.YELLOW);
AddLabel(yes, "Strike: " + strike, Color.YELLOW);
AddLabel(yes, "Open Interest: " + oi, if filter then Color.GREEN else Color.GRAY);
AddLabel(yes, "Volume: " + vol, if filter then Color.GREEN else Color.GRAY);
AddLabel(yes, "Delta: " + delta, if filter then Color.GREEN else Color.GRAY);
AddLabel(yes, "Implied Volatility: " + iv, if filter then Color.GREEN else Color.GRAY);
#Set the background color based on the filter
AssignBackgroundColor(if filter then Color.GREEN else Color.GRAY);
Last edited by a moderator: