Repaints AGAIG Murrey Math Pivot Lines For ThinkOrSwim

Repaints

csricksdds

Trader Educator
VIP
AGAIG As Good As It Gets Murrey Math Pivot Lines For ThinkOrSwim

The Murrey Math lines, created by T.H. Murrey in the 1990s, help spot important price points where the market may reverse or pause (support and resistance levels).
It works by dividing market movements into waves with key price levels, based on the concept of "Gann angles."

This system can be applied to any market: stocks, commodities, or Forex.
By identifying these key levels, traders can make smarter decisions about when to enter or exit trades and where to place stop-losses. It combines math and chart analysis to highlight these important pivot points.

A lot of individuals like the Murrey Math Lines (as do I).
Since I’m somewhat adverse to a lot of lines on a chart, I pared this one down to two upper and two lower
- a period of trend weakening (the two inner)
and
- the peak oversold/overbought where changes usually take place (the two outer).

This is what the chart looks like:
IP8XC3C.jpeg

Ruby:
#Murrays's Math Trendflex Dydtem forceIndex TOS
#Revamped by Charles Ricks 8/22/24
# 8/29/24 moved bubbles to the right

def showOnlyToday = yes;
def RangeHigh = high(period = "DAY")[0];
def RangeLow = low(period = "DAY")[0];
def RangeSize = AbsValue(RangeHigh - RangeLow);
def MMLevel8 = 8 / 8;
def MMLevel7 = 7 / 8;

def MMLevel1 = 1 / 8;
def MMLevel0 = 0 / 8;
def TimeCondition = IsNaN(Close[-1]) and !IsNaN(close[0]);
def MML8 = RangeHigh;
def MML7 = RangeLow + RangeSize * (MMLevel7);

def MML1 = RangeLow + RangeSize * (MMLevel1);
def MML0 = RangeLow;
plot Level8;
plot Level7;

plot Level1;
plot Level0;
if showOnlyToday and !IsNaN(close(period = "DAY")[-1])
then {
Level8 = Double.NaN;
Level7 = Double.NaN;

Level1 = Double.NaN;
Level0 = Double.NaN;
} else {
Level8 = MML8;
Level7 = MML7;

Level1 = MML1;
Level0 = MML0;
}

Level1.SetDefaultColor(color.Yellow);
Level1.SetStyle(curve.Short_Dash);
Level7.HideBubble();


Level8.SetDefaultColor(color.RED);
Level8.SetStyle(curve.Short_Dash);
Level8.HideBubble();

Level7.SetDefaultColor(color.Yellow);
Level7.SetStyle(curve.Short_Dash);
Level7.HideBubble();



Level0.SetDefaultColor(color.Green);
Level0.SetStyle(curve.short_dash);
Level0.HideBubble();

input bubblemover = 2;
def   b = bubblemover;
def limit1 = !IsNaN(close[b+1]) and IsNaN(close [b] );# && HighestAll(BarNumber());

AddChartBubble(limit1, MML0[b+1], "OS PIVOT", Color.Green);
AddChartBubble(limit1 ,MML1[b+1], "OS Weaking", color.yellow, no);
AddChartBubble(Limit1 , MML7 [b+1], "OB Weakening",
color.yellow, yes);
AddChartBubble(Limit1 , Level8 [b+1], "OB Pivot", color.red, no);

The complete strategy can be found:
https://usethinkscript.com/threads/agaig-high-profit-options-trading-chart-for-thinkorswim.19516/
Rrne6uq.jpeg
 
Last edited by a moderator:
Last edited by a moderator:
@csricksdds thanks for posting this. I am curious as to how you like to use this in your trading.
Do you essentially favor these two lines (out of the rest) for use as support and resistance?
Have you found them better than other pivot methods?

can you point me to a favored resource for use in day trading? (ive read some on the internet just wondering which ref you like the best)

thanks!
 
I really like your code. I modified it a bit to handle all timeframes. Also, removed the chart bubbles.

Code:
#Murreys's Math Trendflex Dydtem forceIndex TOS
#Revamped by Charles Ricks 8/22/24
# https://usethinkscript.com/threads/agaig-murrey-math-pivot-lines-for-thinkorswim.19491/

def currAggP = GetAggregationPeriod();
def aggP;

if currAggP >= AggregationPeriod.WEEK {
    aggP = AggregationPeriod.YEAR;
} else {
    if currAggP >= AggregationPeriod.DAY {
        aggP = AggregationPeriod.MONTH;
    } else {
        if currAggP >= AggregationPeriod.THIRTY_MIN {
            aggP = AggregationPeriod.WEEK;
        } else {
            aggP = AggregationPeriod.DAY;
        }
    }
}

def RangeHigh = high(period = aggP);
def RangeLow = low(period = aggP);
def RangeSize = AbsValue(RangeHigh - RangeLow);
def MMLevel7 = 7 / 8;
def MMLevel1 = 1 / 8;
def MML8 = RangeHigh;
def MML7 = RangeLow + RangeSize * (MMLevel7);
def MML1 = RangeLow + RangeSize * (MMLevel1);
def MML0 = RangeLow;

plot Level8;
plot Level7;
plot Level1;
plot Level0;

if !IsNaN(close(period = aggP)[-1]) {
    Level8 = Double.NaN;
    Level7 = Double.NaN;
    Level1 = Double.NaN;
    Level0 = Double.NaN;
} else {
    Level8 = MML8;
    Level7 = MML7;
    Level1 = MML1;
    Level0 = MML0;
}

Level8.SetDefaultColor(Color.CYAN);
Level8.SetStyle(Curve.MEDIUM_DASH);
Level8.HideBubble();

Level7.SetDefaultColor(Color.YELLOW);
Level7.SetStyle(Curve.SHORT_DASH);
Level7.HideBubble();

Level1.SetDefaultColor(Color.YELLOW);
Level1.SetStyle(Curve.SHORT_DASH);
Level1.HideBubble();

Level0.SetDefaultColor(Color.CYAN);
Level0.SetStyle(Curve.MEDIUM_DASH);
Level0.HideBubble();

# EOS
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
414 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top