# input the nearest Strike you want to find, supply the StopStrike, and Expiration Date
# example: GetNearestStrikeAtOrAbove(221,230,"211126", returns 225
# give the return result up to 1 minute for results
script GetNearestStrikeAtOrAbove {
input Strike = 0; # enter the price you want to find for the nearest srike
input StopStrike = 0; # stop looking for the option once you hit this price
input ExpirationDate = "YYMMDD";
def OptionStrike = fold i = Strike to StopStrike with
OptStrike=0
while OptStrike==0 do
if IsNaN(close(GetNextOTMOption("."+GetUnderlyingSymbol()+ExpirationDate+"C"+Round(i,0)))) then 0 else i;
plot StrikePrice = OptionStrike;
}
# input the nearest Strike you want to find, supply the StopStrike, and Expiration Date
# example: GetNearestStrikeAtOrBelow(200,212,"211126", returns 200
# give the return result up to 1 minute for results
script GetNearestStrikeAtOrBelow {
input Strike = 0; # enter the price you want to find for the nearest srike
input StopStrike = 0; # stop looking for the option once you hit this price
input ExpirationDate = "YYMMDD";
def OptionStrike = fold i = Strike to Stopstrike with
OptStrike=0
while OptStrike==0 do
if IsNaN(close(GetNextOTMOption("."+GetUnderlyingSymbol()+ExpirationDate+"P"+Round(i,0)))) then 0 else i;
plot StrikePrice = OptionStrike;
}
AddLabel(yes,"GetNearestStrikeAtOrAbove="+GetNearestStrikeAtOrAbove(221,230,"211126"),color.white);
AddLabel(yes,"GetNearestStrikeAtOrBelow="+GetNearestStrikeAtOrBelow(200,212,"211126"),color.white);
# example: GetNearestStrikeAtOrAbove(221,230,"211126", returns 225
# give the return result up to 1 minute for results
script GetNearestStrikeAtOrAbove {
input Strike = 0; # enter the price you want to find for the nearest srike
input StopStrike = 0; # stop looking for the option once you hit this price
input ExpirationDate = "YYMMDD";
def OptionStrike = fold i = Strike to StopStrike with
OptStrike=0
while OptStrike==0 do
if IsNaN(close(GetNextOTMOption("."+GetUnderlyingSymbol()+ExpirationDate+"C"+Round(i,0)))) then 0 else i;
plot StrikePrice = OptionStrike;
}
# input the nearest Strike you want to find, supply the StopStrike, and Expiration Date
# example: GetNearestStrikeAtOrBelow(200,212,"211126", returns 200
# give the return result up to 1 minute for results
script GetNearestStrikeAtOrBelow {
input Strike = 0; # enter the price you want to find for the nearest srike
input StopStrike = 0; # stop looking for the option once you hit this price
input ExpirationDate = "YYMMDD";
def OptionStrike = fold i = Strike to Stopstrike with
OptStrike=0
while OptStrike==0 do
if IsNaN(close(GetNextOTMOption("."+GetUnderlyingSymbol()+ExpirationDate+"P"+Round(i,0)))) then 0 else i;
plot StrikePrice = OptionStrike;
}
AddLabel(yes,"GetNearestStrikeAtOrAbove="+GetNearestStrikeAtOrAbove(221,230,"211126"),color.white);
AddLabel(yes,"GetNearestStrikeAtOrBelow="+GetNearestStrikeAtOrBelow(200,212,"211126"),color.white);