declare upper;
def price = close;
input abovebelow = 3;
def null = double.nan;
def rounded = round(price / 25, 0);
def scaled = rounded * 25;
plot curPrice = scaled;
curPrice.setLineWeight(3);
plot above1 = if abovebelow >= 1 then scaled + 25 else null;
plot above2 = if abovebelow >= 2 then scaled + 50 else null;
plot above3 = if...
declare upper;
def price = close;
input abovebelow = 3;
def null = double.nan;
def rounded = round(price / 25, 0);
def scaled = rounded * 25;
plot curPrice = scaled;
curPrice.setLineWeight(3);
plot above1 = if abovebelow >= 1 then scaled + 25 else null;
plot above2 = if abovebelow >= 2 then scaled + 50 else null;
plot above3 = if abovebelow >= 3 then scaled + 75 else null;
plot above4 = if abovebelow >= 4 then scaled + 100 else null;
plot above5 = if abovebelow >= 5 then scaled + 125 else null;
plot above6 = if abovebelow >= 6 then scaled + 150 else null;
plot below1 = if abovebelow >= 1 then scaled - 25 else null;
plot below2 = if abovebelow >= 2 then scaled - 50 else null;
plot below3 = if abovebelow >= 3 then scaled - 75 else null;
plot below4 = if abovebelow >= 4 then scaled - 100 else null;
plot below5 = if abovebelow >= 5 then scaled - 125 else null;
plot below6 = if abovebelow >= 6 then scaled - 150 else null;
Hi - is there a ToS study that draws horizontal lines at specific price intervals? I want to draw it for SPX at all level at the 25's e.g. 7700/7725/7750/7775.
# 6/27/25
# Auto Horizontal Lines
input x = 2;
plot price1 = 0.8;
price1.SetDefaultColor(Color.DARK_GREEN);
price1.SetPaintingStrategy(PaintingStrategy.DASHES);
price1.SetLineWeight(2);
plot price2 = 1;
price2.SetDefaultColor(Color.DARK_GREEN);
price2.SetPaintingStrategy(PaintingStrategy.DASHES);
price2.SetLineWeight(2);
plot price3 = 1.2;
price3.SetDefaultColor(Color.DARK_GREEN);
price3.SetPaintingStrategy(PaintingStrategy.DASHES);
price3.SetLineWeight(2);
plot price4 = 1.5;
price4.SetDefaultColor(Color.DARK_GREEN);
price4.SetPaintingStrategy(PaintingStrategy.DASHES);
price4.SetLineWeight(2);
plot price5 = 1.75;
price5.SetDefaultColor(Color.DARK_GREEN);
price5.SetPaintingStrategy(PaintingStrategy.DASHES);
price5.SetLineWeight(2);
plot price6 = 2.25;
price6.SetDefaultColor(Color.DARK_GREEN);
price6.SetPaintingStrategy(PaintingStrategy.DASHES);
price6.SetLineWeight(2);
plot price7 = 2.75;
price7.SetDefaultColor(Color.DARK_GREEN);
price7.SetPaintingStrategy(PaintingStrategy.DASHES);
price7.SetLineWeight(2);
plot price8 = 3.5;
price8.SetDefaultColor(Color.DARK_GREEN);
price8.SetPaintingStrategy(PaintingStrategy.DASHES);
price8.SetLineWeight(2);
plot price9 = 4.25;
price9.SetDefaultColor(Color.DARK_GREEN);
price9.SetPaintingStrategy(PaintingStrategy.DASHES);
price9.SetLineWeight(2);
plot price10 = 5.25;
price10.SetDefaultColor(Color.DARK_GREEN);
price10.SetPaintingStrategy(PaintingStrategy.DASHES);
price10.SetLineWeight(2);
plot price11 = 6.5;
price11.SetDefaultColor(Color.DARK_GREEN);
price11.SetPaintingStrategy(PaintingStrategy.DASHES);
price11.SetLineWeight(2);
plot price12 = 8;
price12.SetDefaultColor(Color.DARK_GREEN);
price12.SetPaintingStrategy(PaintingStrategy.DASHES);
price12.SetLineWeight(2);
plot price13 = 10;
price13.SetDefaultColor(Color.DARK_GREEN);
price13.SetPaintingStrategy(PaintingStrategy.DASHES);
price13.SetLineWeight(2);
plot price14 = 12.25;
price14.SetDefaultColor(Color.DARK_GREEN);
price14.SetPaintingStrategy(PaintingStrategy.DASHES);
price14.SetLineWeight(2);
plot price15 = 14;
price15.SetDefaultColor(Color.DARK_GREEN);
price15.SetPaintingStrategy(PaintingStrategy.DASHES);
price15.SetLineWeight(2);
plot price16 = 16;
price16.SetDefaultColor(Color.DARK_GREEN);
price16.SetPaintingStrategy(PaintingStrategy.DASHES);
price16.SetLineWeight(2);
plot price17 = 20.25;
price17.SetDefaultColor(Color.DARK_GREEN);
price17.SetPaintingStrategy(PaintingStrategy.DASHES);
price17.SetLineWeight(2);
plot price18 = 24.5;
price18.SetDefaultColor(Color.DARK_GREEN);
price18.SetPaintingStrategy(PaintingStrategy.DASHES);
price18.SetLineWeight(2);
plot price19 = 28.75;
price19.SetDefaultColor(Color.DARK_GREEN);
price19.SetPaintingStrategy(PaintingStrategy.DASHES);
price19.SetLineWeight(2);
plot price20 = 33;
price20.SetDefaultColor(Color.DARK_GREEN);
price20.SetPaintingStrategy(PaintingStrategy.DASHES);
price20.SetLineWeight(2);
plot price21 = 38.5;
price21.SetDefaultColor(Color.DARK_GREEN);
price21.SetPaintingStrategy(PaintingStrategy.DASHES);
price21.SetLineWeight(2);
plot price22 = 44;
price22.SetDefaultColor(Color.DARK_GREEN);
price22.SetPaintingStrategy(PaintingStrategy.DASHES);
price22.SetLineWeight(2);
plot price23 = 49.5;
price23.SetDefaultColor(Color.DARK_GREEN);
price23.SetPaintingStrategy(PaintingStrategy.DASHES);
price23.SetLineWeight(2);
plot price24 = 55;
price24.SetDefaultColor(Color.DARK_GREEN);
price24.SetPaintingStrategy(PaintingStrategy.DASHES);
price24.SetLineWeight(2);
plot price25 = 65;
price25.SetDefaultColor(Color.DARK_GREEN);
price25.SetPaintingStrategy(PaintingStrategy.DASHES);
price25.SetLineWeight(2);
plot price26 = 77;
price26.SetDefaultColor(Color.DARK_GREEN);
price26.SetPaintingStrategy(PaintingStrategy.DASHES);
price26.SetLineWeight(2);
plot price27 = 88;
price27.SetDefaultColor(Color.DARK_GREEN);
price27.SetPaintingStrategy(PaintingStrategy.DASHES);
price27.SetLineWeight(2);
plot price28 = 99;
price28.SetDefaultColor(Color.DARK_GREEN);
price28.SetPaintingStrategy(PaintingStrategy.DASHES);
price28.SetLineWeight(2);
plot price29 = 110;
price29.SetDefaultColor(Color.DARK_GREEN);
price29.SetPaintingStrategy(PaintingStrategy.DASHES);
price29.SetLineWeight(2);
plot price30 = 130;
price30.SetDefaultColor(Color.DARK_GREEN);
price30.SetPaintingStrategy(PaintingStrategy.DASHES);
price30.SetLineWeight(2);
plot price31 = 154;
price31.SetDefaultColor(Color.DARK_GREEN);
price31.SetPaintingStrategy(PaintingStrategy.DASHES);
price31.SetLineWeight(2);
plot price32 = 180;
price32.SetDefaultColor(Color.DARK_GREEN);
price32.SetPaintingStrategy(PaintingStrategy.DASHES);
price32.SetLineWeight(2);
plot price33 = 205;
price33.SetDefaultColor(Color.DARK_GREEN);
price33.SetPaintingStrategy(PaintingStrategy.DASHES);
price33.SetLineWeight(2);
plot price34 = 240;
price34.SetDefaultColor(Color.DARK_GREEN);
price34.SetPaintingStrategy(PaintingStrategy.DASHES);
price34.SetLineWeight(2);
plot price35 = 275;
price35.SetDefaultColor(Color.DARK_GREEN);
price35.SetPaintingStrategy(PaintingStrategy.DASHES);
price35.SetLineWeight(2);
plot price36 = 320;
price36.SetDefaultColor(Color.DARK_GREEN);
price36.SetPaintingStrategy(PaintingStrategy.DASHES);
price36.SetLineWeight(2);
plot price37 = 370;
price37.SetDefaultColor(Color.DARK_GREEN);
price37.SetPaintingStrategy(PaintingStrategy.DASHES);
price37.SetLineWeight(2);
plot price38 = 430;
price38.SetDefaultColor(Color.DARK_GREEN);
price38.SetPaintingStrategy(PaintingStrategy.DASHES);
price38.SetLineWeight(2);
plot price39 = 500;
price39.SetDefaultColor(Color.DARK_GREEN);
price39.SetPaintingStrategy(PaintingStrategy.DASHES);
price39.SetLineWeight(2);
plot price40 = 580;
price40.SetDefaultColor(Color.DARK_GREEN);
price40.SetPaintingStrategy(PaintingStrategy.DASHES);
price40.SetLineWeight(2);
plot price41 = 675;
price41.SetDefaultColor(Color.DARK_GREEN);
price41.SetPaintingStrategy(PaintingStrategy.DASHES);
price41.SetLineWeight(2);
plot price42 = 780;
price42.SetDefaultColor(Color.DARK_GREEN);
price42.SetPaintingStrategy(PaintingStrategy.DASHES);
price42.SetLineWeight(2);
plot price43 = 905;
price43.SetDefaultColor(Color.DARK_GREEN);
price43.SetPaintingStrategy(PaintingStrategy.DASHES);
price43.SetLineWeight(2);
plot price44 = 1050;
price44.SetDefaultColor(Color.DARK_GREEN);
price44.SetPaintingStrategy(PaintingStrategy.DASHES);
price44.SetLineWeight(2);
plot price45 = 1220;
price45.SetDefaultColor(Color.DARK_GREEN);
price45.SetPaintingStrategy(PaintingStrategy.DASHES);
price45.SetLineWeight(2);
plot price46 = 1415;
price46.SetDefaultColor(Color.DARK_GREEN);
price46.SetPaintingStrategy(PaintingStrategy.DASHES);
price46.SetLineWeight(2);
plot price47 = 1640;
price47.SetDefaultColor(Color.DARK_GREEN);
price47.SetPaintingStrategy(PaintingStrategy.DASHES);
price47.SetLineWeight(2);
plot price48 = 1900;
price48.SetDefaultColor(Color.DARK_GREEN);
price48.SetPaintingStrategy(PaintingStrategy.DASHES);
price48.SetLineWeight(2);
plot price49 = 2210;
price49.SetDefaultColor(Color.DARK_GREEN);
price49.SetPaintingStrategy(PaintingStrategy.DASHES);
price49.SetLineWeight(2);
plot price50 = 2560;
price50.SetDefaultColor(Color.DARK_GREEN);
price50.SetPaintingStrategy(PaintingStrategy.DASHES);
price50.SetLineWeight(2);
plot price51 = 2970;
price51.SetDefaultColor(Color.DARK_GREEN);
price51.SetPaintingStrategy(PaintingStrategy.DASHES);
price51.SetLineWeight(2);
plot price52 = 3445;
price52.SetDefaultColor(Color.DARK_GREEN);
price52.SetPaintingStrategy(PaintingStrategy.DASHES);
price52.SetLineWeight(2);
plot price53 = 4000;
price53.SetDefaultColor(Color.DARK_GREEN);
price53.SetPaintingStrategy(PaintingStrategy.DASHES);
price53.SetLineWeight(2);
plot price54 = 4640;
price54.SetDefaultColor(Color.DARK_GREEN);
price54.SetPaintingStrategy(PaintingStrategy.DASHES);
price54.SetLineWeight(2);
input alerts = yes;
Alert(alerts and close crosses price1, "** Magic# " + price1, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price2, "** Magic# " + price2, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price3, "** Magic# " + price3, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price4, "** Magic# " + price4, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price5, "** Magic# " + price5, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price6, "** Magic# " + price6, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price7, "** Magic# " + price7, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price8, "** Magic# " + price8, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price9, "** Magic# " + price9, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price10, "** Magic# " + price10, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price11, "** Magic# " + price11, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price12, "** Magic# " + price12, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price13, "** Magic# " + price13, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price14, "** Magic# " + price14, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price15, "** Magic# " + price15, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price16, "** Magic# " + price16, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price17, "** Magic# " + price17, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price18, "** Magic# " + price18, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price19, "** Magic# " + price19, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price20, "** Magic# " + price20, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price21, "** Magic# " + price21, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price22, "** Magic# " + price22, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price23, "** Magic# " + price23, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price24, "** Magic# " + price24, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price25, "** Magic# " + price25, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price26, "** Magic# " + price26, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price27, "** Magic# " + price27, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price28, "** Magic# " + price28, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price29, "** Magic# " + price29, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price30, "** Magic# " + price30, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price31, "** Magic# " + price31, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price32, "** Magic# " + price32, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price33, "** Magic# " + price33, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price34, "** Magic# " + price34, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price35, "** Magic# " + price35, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price36, "** Magic# " + price36, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price37, "** Magic# " + price37, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price38, "** Magic# " + price38, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price39, "** Magic# " + price39, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price40, "** Magic# " + price40, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price41, "** Magic# " + price41, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price42, "** Magic# " + price42, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price43, "** Magic# " + price43, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price44, "** Magic# " + price44, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price45, "** Magic# " + price45, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price46, "** Magic# " + price46, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price47, "** Magic# " + price47, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price48, "** Magic# " + price48, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price49, "** Magic# " + price49, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price50, "** Magic# " + price50, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price51, "** Magic# " + price51, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price52, "** Magic# " + price52, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price53, "** Magic# " + price53, Alert.BAR, Sound.Ding);
Alert(alerts and close crosses price54, "** Magic# " + price54, Alert.BAR, Sound.Ding);
addlabel(1,
if close crosses price1 within x bars then " Magic# " + price1 else if close crosses price2 within x bars then " Magic# " + price2 else if close crosses price3 within x bars then " Magic# " + price3 else if close crosses price4 within x bars then " Magic# " + price4 else if close crosses price5 within x bars then " Magic# " + price5 else if close crosses price6 within x bars then " Magic# " + price6 else if close crosses price7 within x bars then " Magic# " + price7 else if close crosses price8 within x bars then " Magic# " + price8 else if close crosses price9 within x bars then " Magic# " + price9 else if close crosses price10 within x bars then " Magic# " + price10 else if close crosses price11 within x bars then " Magic# " + price11 else if close crosses price12 within x bars then " Magic# " + price12 else if close crosses price13 within x bars then " Magic# " + price13 else if close crosses price14 within x bars then " Magic# " + price14 else if close crosses price15 within x bars then " Magic# " + price15 else if close crosses price16 within x bars then " Magic# " + price16 else if close crosses price17 within x bars then " Magic# " + price17 else if close crosses price18 within x bars then " Magic# " + price18 else if close crosses price19 within x bars then " Magic# " + price19 else if close crosses price20 within x bars then " Magic# " + price20 else if close crosses price21 within x bars then " Magic# " + price21 else if close crosses price22 within x bars then " Magic# " + price22 else if close crosses price23 within x bars then " Magic# " + price23 else if close crosses price24 within x bars then " Magic# " + price24 else if close crosses price25 within x bars then " Magic# " + price25 else if close crosses price26 within x bars then " Magic# " + price26 else if close crosses price27 within x bars then " Magic# " + price27 else if close crosses price28 within x bars then " Magic# " + price28 else if close crosses price29 within x bars then " Magic# " + price29 else if close crosses price30 within x bars then " Magic# " + price30 else if close crosses price31 within x bars then " Magic# " + price31 else if close crosses price32 within x bars then " Magic# " + price32 else if close crosses price33 within x bars then " Magic# " + price33 else if close crosses price34 within x bars then " Magic# " + price34 else if close crosses price35 within x bars then " Magic# " + price35 else if close crosses price36 within x bars then " Magic# " + price36 else if close crosses price37 within x bars then " Magic# " + price37 else if close crosses price38 within x bars then " Magic# " + price38 else if close crosses price39 within x bars then " Magic# " + price39 else if close crosses price40 within x bars then " Magic# " + price40 else if close crosses price41 within x bars then " Magic# " + price41 else if close crosses price42 within x bars then " Magic# " + price42 else if close crosses price43 within x bars then " Magic# " + price43 else if close crosses price44 within x bars then " Magic# " + price44 else if close crosses price45 within x bars then " Magic# " + price45 else if close crosses price46 within x bars then " Magic# " + price46 else if close crosses price47 within x bars then " Magic# " + price47 else if close crosses price48 within x bars then " Magic# " + price48 else if close crosses price49 within x bars then " Magic# " + price49 else if close crosses price50 within x bars then " Magic# " + price50 else if close crosses price51 within x bars then " Magic# " + price51 else if close crosses price52 within x bars then " Magic# " + price52 else if close crosses price53 within x bars then " Magic# " + price53 else if close crosses price54 within x bars then " Magic# " + price54 else "",
Color.black);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
| Thread starter | Similar threads | Forum | Replies | Date |
|---|---|---|---|---|
| L | horizon line when price level has been hit at least twice | Questions | 2 | |
| C | plot a "price level line" | Questions | 5 | |
| N | RSI Price level | Questions | 2 | |
|
|
Add price level with text on the left via ThinkScript | Questions | 1 | |
| I | Create Custom Label Comparing Current Price to a Specific Level | Questions | 1 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.