Watchlist Levels Code

  • Home
  • /
  • Watchlist Levels Code

Thinkorswim

# Last Updated at 2022-09-26 09:14:07 EDT
# License: Copyright 2020-2022 Edumomo LLC. All rights reserved.  
# Permission is hereby granted to any person obtaining this software and associated documentation (the "Software") through authorized channels to use the software and modified for personal use only.  The software may not be modified for any other purpose. The software may not be copied, shared, or redistributed without written authorization. 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS, OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.            
                   
# HOW TO SETUP https://youtu.be/NmrVME8LBBg
declare hide_on_daily;
declare once_per_bar;
def buffer = 0.001;
def iws;  
input levels_width = 2;
DefineGlobalColor("Label_Color", CreateColor(25, 180, 243));
DefineGlobalColor("Level_Color", CreateColor(25, 180, 243));

        
plot previous_close =  close(period = AggregationPeriod.DAY)[1];
previous_close.SetDefaultColor(GlobalColor("Level_Color"));
previous_close.setLineWeight(levels_width);


def level1;
def condition1;
def level2;
def condition2;
def level3;
def condition3;
def level4;
def condition4;
def level5;
def condition5;
def level6;
def condition6;
def level7;
def condition7;
def level8;
def condition8;
def level9;
def condition9;
def level10;
def condition10;
def level11;
def condition11;          
if GetSymbol() equals "MDB" {  
iws=1;
level1 = 160;
level2 = 185;
level3 = 202.50;
level4 = 211;
level5 = 214;
level6 = 217;
level7 = 221;
level8 = 225;
level9 = 0;
level10 = 0;
level11 = 0;
}
else          
if GetSymbol() equals "NVDA" {  
iws=1;
level1 = 108.60;
level2 = 116;
level3 = 118;
level4 = 122;
level5 = 124.50;
level6 = 126;
level7 = 129;
level8 = 132.50;
level9 = 134;
level10 = 0;
level11 = 0;
}
else          
if GetSymbol() equals "QQQ" {  
iws=1;
level1 = 270;
level2 = 272;
level3 = 276;
level4 = 280;
level5 = 286;
level6 = 289;
level7 = 291.50;
level8 = 296;
level9 = 300;
level10 = 0;
level11 = 0;
}
else          
if GetSymbol() equals "SPY" {  
iws=1;
level1 = 350;
level2 = 358;
level3 = 360;
level4 = 361;
level5 = 364;
level6 = 368;
level7 = 369.30;
level8 = 372;
level9 = 373.50;
level10 = 374.20;
level11 = 377;
}
else          
if GetSymbol() equals "TSLA" {  
iws=1;
level1 = 249;
level2 = 265;
level3 = 269;
level4 = 275;
level5 = 279;
level6 = 286;
level7 = 292;
level8 = 296;
level9 = 299.70;
level10 = 0;
level11 = 0;
}
else {
 iws=0;
level1=0;
level2=0;
level3=0;
level4=0;
level5=0;
level6=0;
level7=0;
level8=0;
level9=0;
level10=0;
level11=0;
}
plot pLevel1 = level1;
if pLevel1>0 {    
    condition1 = Crosses(close, (pLevel1+(buffer*pLevel1)),CrossingDirection.ANY) OR Crosses(close, (pLevel1-(buffer*pLevel1)),CrossingDirection.ANY);
} else {
    condition1 =0;
}
pLevel1.SetStyle(Curve.SHORT_DASH);
pLevel1.SetDefaultColor(GlobalColor("Level_Color"));
pLevel1.setHiding(level1 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel1.SetLineWeight(levels_width);
plot pLevel2 = level2;
if pLevel2>0 {    
    condition2 = Crosses(close, (pLevel2+(buffer*pLevel2)),CrossingDirection.ANY) OR Crosses(close, (pLevel2-(buffer*pLevel2)),CrossingDirection.ANY);
} else {
    condition2 =0;
}
pLevel2.SetStyle(Curve.SHORT_DASH);
pLevel2.SetDefaultColor(GlobalColor("Level_Color"));
pLevel2.setHiding(level2 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel2.SetLineWeight(levels_width);
plot pLevel3 = level3;
if pLevel3>0 {    
    condition3 = Crosses(close, (pLevel3+(buffer*pLevel3)),CrossingDirection.ANY) OR Crosses(close, (pLevel3-(buffer*pLevel3)),CrossingDirection.ANY);
} else {
    condition3 =0;
}
pLevel3.SetStyle(Curve.SHORT_DASH);
pLevel3.SetDefaultColor(GlobalColor("Level_Color"));
pLevel3.setHiding(level3 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel3.SetLineWeight(levels_width);
plot pLevel4 = level4;
if pLevel4>0 {    
    condition4 = Crosses(close, (pLevel4+(buffer*pLevel4)),CrossingDirection.ANY) OR Crosses(close, (pLevel4-(buffer*pLevel4)),CrossingDirection.ANY);
} else {
    condition4 =0;
}
pLevel4.SetStyle(Curve.SHORT_DASH);
pLevel4.SetDefaultColor(GlobalColor("Level_Color"));
pLevel4.setHiding(level4 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel4.SetLineWeight(levels_width);
plot pLevel5 = level5;
if pLevel5>0 {    
    condition5 = Crosses(close, (pLevel5+(buffer*pLevel5)),CrossingDirection.ANY) OR Crosses(close, (pLevel5-(buffer*pLevel5)),CrossingDirection.ANY);
} else {
    condition5 =0;
}
pLevel5.SetStyle(Curve.SHORT_DASH);
pLevel5.SetDefaultColor(GlobalColor("Level_Color"));
pLevel5.setHiding(level5 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel5.SetLineWeight(levels_width);
plot pLevel6 = level6;
if pLevel6>0 {    
    condition6 = Crosses(close, (pLevel6+(buffer*pLevel6)),CrossingDirection.ANY) OR Crosses(close, (pLevel6-(buffer*pLevel6)),CrossingDirection.ANY);
} else {
    condition6 =0;
}
pLevel6.SetStyle(Curve.SHORT_DASH);
pLevel6.SetDefaultColor(GlobalColor("Level_Color"));
pLevel6.setHiding(level6 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel6.SetLineWeight(levels_width);
plot pLevel7 = level7;
if pLevel7>0 {    
    condition7 = Crosses(close, (pLevel7+(buffer*pLevel7)),CrossingDirection.ANY) OR Crosses(close, (pLevel7-(buffer*pLevel7)),CrossingDirection.ANY);
} else {
    condition7 =0;
}
pLevel7.SetStyle(Curve.SHORT_DASH);
pLevel7.SetDefaultColor(GlobalColor("Level_Color"));
pLevel7.setHiding(level7 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel7.SetLineWeight(levels_width);
plot pLevel8 = level8;
if pLevel8>0 {    
    condition8 = Crosses(close, (pLevel8+(buffer*pLevel8)),CrossingDirection.ANY) OR Crosses(close, (pLevel8-(buffer*pLevel8)),CrossingDirection.ANY);
} else {
    condition8 =0;
}
pLevel8.SetStyle(Curve.SHORT_DASH);
pLevel8.SetDefaultColor(GlobalColor("Level_Color"));
pLevel8.setHiding(level8 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel8.SetLineWeight(levels_width);
plot pLevel9 = level9;
if pLevel9>0 {    
    condition9 = Crosses(close, (pLevel9+(buffer*pLevel9)),CrossingDirection.ANY) OR Crosses(close, (pLevel9-(buffer*pLevel9)),CrossingDirection.ANY);
} else {
    condition9 =0;
}
pLevel9.SetStyle(Curve.SHORT_DASH);
pLevel9.SetDefaultColor(GlobalColor("Level_Color"));
pLevel9.setHiding(level9 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel9.SetLineWeight(levels_width);
plot pLevel10 = level10;
if pLevel10>0 {    
    condition10 = Crosses(close, (pLevel10+(buffer*pLevel10)),CrossingDirection.ANY) OR Crosses(close, (pLevel10-(buffer*pLevel10)),CrossingDirection.ANY);
} else {
    condition10 =0;
}
pLevel10.SetStyle(Curve.SHORT_DASH);
pLevel10.SetDefaultColor(GlobalColor("Level_Color"));
pLevel10.setHiding(level10 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel10.SetLineWeight(levels_width);
plot pLevel11 = level11;
if pLevel11>0 {    
    condition11 = Crosses(close, (pLevel11+(buffer*pLevel11)),CrossingDirection.ANY) OR Crosses(close, (pLevel11-(buffer*pLevel11)),CrossingDirection.ANY);
} else {
    condition11 =0;
}
pLevel11.SetStyle(Curve.SHORT_DASH);
pLevel11.SetDefaultColor(GlobalColor("Level_Color"));
pLevel11.setHiding(level11 equals 0 or getAggregationPeriod()>AggregationPeriod.WEEK);
pLevel11.SetLineWeight(levels_width);

plot watchlistSymbol = iws;
watchlistSymbol.setHiding(1);       
plot  breakout = if condition1 or condition2 or condition3 or condition4 or condition5 or condition6 or condition7 or condition8 or condition9 or condition10 or condition11  then  1 else 0; 
breakout.setHiding(1);
AddLabel(GetSymbol() equals "MDB"," with 202.50 break, lots of downside room", GlobalColor("Label_Color"));
AddLabel(GetSymbol() equals "NVDA"," 126 key level, target 118-120", GlobalColor("Label_Color"));
AddLabel(GetSymbol() equals "QQQ"," watch for trend.", GlobalColor("Label_Color"));
AddLabel(GetSymbol() equals "SPY"," planning to play for range tests until direction set.", GlobalColor("Label_Color"));
AddLabel(GetSymbol() equals "TSLA"," nice gap down  overall imho  TSLA needs to play catch up to downside", GlobalColor("Label_Color"));
Alert(condition1  or condition2  or condition3  or condition4  or condition5  or condition6  or condition7  or condition8  or condition9  or condition10  or condition11 ,  GetSymbol() +" Key Level_Crossed!", Alert.ONCE,Sound.Ding);

TradingView

// Last Updated at 2022-09-26 09:14:07 EDT
// License Copyright 2020-2022 Edumomo LLC. All rights reserved.  
// Permission is hereby granted to any person obtaining this software and associated documentation (the "Software") through authorized channels to use the software and modified for personal use only.  The software may not be modified for any other purpose. The software may not be copied, shared, or redistributed without written authorization. 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS, OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.            
        
//@version=4
//TO Use: https://youtu.be/Nb2q1ihtcGY
study("Spectre Watchlist Levels", overlay=true, shorttitle="SpectreLVLS")
src = input(close)
// Constants colours that include fully non-transparent option.
gold = color.yellow
green = color.green
blue = color.blue
aqua = color.aqua
red = color.red
fuchsia = color.fuchsia
purple = color.purple
silver = color.silver
gray = color.gray
orange = color.orange
black = color.black
dashed = hline.style_dashed
solid = hline.style_solid
ticker = syminfo.ticker
crossshape = shape.square
// Create series vars marking six SR prices for each pair
plotHLines = input(title="plotHLines", type=input.bool, defval=true)
//timeperiod = input(title="timeframe", type=input.string)
hlineStyle = solid
hlineWidth = 3
hlineColor = blue
    
level1 = 1.23456
level1 := na
            
level2 = 1.23456
level2 := na
            
level3 = 1.23456
level3 := na
            
level4 = 1.23456
level4 := na
            
level5 = 1.23456
level5 := na
            
level6 = 1.23456
level6 := na
            
level7 = 1.23456
level7 := na
            
level8 = 1.23456
level8 := na
            
level9 = 1.23456
level9 := na
            
level10 = 1.23456
level10 := na
            
level11 = 1.23456
level11 := na
            
// if condition is true then the hline plots
// --------------------------------       
        
if ( ticker == "MDB" and plotHLines and timeframe.isintraday )              
    level1 := 160
    level2 := 185
    level3 := 202.50
    level4 := 211
    level5 := 214
    level6 := 217
    level7 := 221
    level8 := 225
if ( ticker == "NVDA" and plotHLines and timeframe.isintraday )              
    level1 := 108.60
    level2 := 116
    level3 := 118
    level4 := 122
    level5 := 124.50
    level6 := 126
    level7 := 129
    level8 := 132.50
    level9 := 134
if ( ticker == "QQQ" and plotHLines and timeframe.isintraday )              
    level1 := 270
    level2 := 272
    level3 := 276
    level4 := 280
    level5 := 286
    level6 := 289
    level7 := 291.50
    level8 := 296
    level9 := 300
if ( ticker == "SPY" and plotHLines and timeframe.isintraday )              
    level1 := 350
    level2 := 358
    level3 := 360
    level4 := 361
    level5 := 364
    level6 := 368
    level7 := 369.30
    level8 := 372
    level9 := 373.50
    level10 := 374.20
    level11 := 377
if ( ticker == "TSLA" and plotHLines and timeframe.isintraday )              
    level1 := 249
    level2 := 265
    level3 := 269
    level4 := 275
    level5 := 279
    level6 := 286
    level7 := 292
    level8 := 296
    level9 := 299.70
isUp = close >= open
        
plot(level1, 'level1',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level1), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level2, 'level2',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level2), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level3, 'level3',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level3), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level4, 'level4',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level4), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level5, 'level5',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level5), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level6, 'level6',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level6), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level7, 'level7',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level7), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level8, 'level8',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level8), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level9, 'level9',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level9), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level10, 'level10',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level10), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)
plot(level11, 'level11',hlineColor,hlineWidth,hlineStyle,offset=0)
plotshape(cross(open,level11), color=isUp ? color.lime : color.red, text="", textcolor=isUp ? color.black : color.white, style=crossshape, location=location.abovebar)

Watchlist tickers

 MDB NVDA QQQ SPY TSLA
Easy Video Reviews

{{startingCount}}
{{time(finishingCount)}}
{{trans(`You have no camera installed on your device or the device is currently being used by other application`)}}
{{trans(`Please try visiting this page with a valid SSL certificate`)}}
{{trans(`You can record up to %s minutes, don't worry you will review your video before sending`, time(preference.limits))}}
{{trans('Seconds')}}
{{trans(`You can record up to %s minutes, don't worry you will review your video before sending`, time(preference.limits))}}
{{trans('Uploading video...')}}
{{send.message}}

{{trans('Upload video')}}

{{trans('Drag your files here or click in this area')}}
{{uploader.file}} {{uploader.size}} x
>