Moxie Indicator for ThinkorSwim

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Hi Slippage, which is the scan i can use for price above sma50s and moxie above zero on the daily?

You can find the pieces you need for that in this post. You want #2 and #3. You can also use those for any other timeframes you want just by adjusting the timeframe of the scan.
 
Last edited:
@tradegeek IMO, I would just move on. Never buy an indicator. Find a system that works for you and keep working it. There are many hundred of them on this website to research. Start in the Tutorials as well as Look at the built in Strategies.

Code:
# Moxie_PriceChannel_Adjustable
# Built on 5/11/20
# For use on a All Time Frames

input channelLength = 34;
input averageType = AverageType.EXPONENTIAL;
input PriceChannel_Aggregation = AggregationPeriod.FIFTEEN_MIN;
input Moxie_highestAggregation = AggregationPeriod.TEN_MIN;
input Moxie_lowestAggregation = AggregationPeriod.FIVE_MIN;

def MovAvg_H = MovingAverage(averageType, high, channelLength);
def MovAvg_C = MovingAverage(averageType, close, channelLength);
def MovAvg_L = MovingAverage(averageType, low, channelLength);

def MovAvg_H1x = (MovAvg_H - MovAvg_L) + MovAvg_H;
def MovAvg_L1x = MovAvg_L - (MovAvg_H - MovAvg_L);

# HTF_Ergodic Momentum ----------------------------------------------
def diff = close(period=PriceChannel_Aggregation) - close(period=PriceChannel_Aggregation)[1];
def TSI  = (ExpAverage(ExpAverage(diff, 32), 5)) / (ExpAverage(ExpAverage(AbsValue(diff), 32), 5)) * 100;
def Signal = ExpAverage(TSI, 5);
def Momentum = TSI - Signal;
def LHMult = If (.01 <> 0, (1 / 0.01), 0);
def TSVBlues = If (Momentum >= 0, Momentum, 0);
def TSVMomentum_Pos = TSVBlues * LHMult;
def TSVReds = If (Momentum < 0, Momentum, 0);
def TSVMomentum_Neg = TSVReds * LHMult;

# HTF ERGODIC Price Channel Momentum Indicator ----------------------------------------
plot PC_H = MovAvg_H;
plot PC_L = MovAvg_L;

PC_H.DefineColor("SlopeUp", CreateColor(0, 153, 0)); #createColor(0,153,0)); GREEN
PC_H.DefineColor("NoSlope", Color.GRAY);
PC_H.DefineColor("SlopeDown", Color.RED);
PC_H.AssignValueColor(if TSVmomentum_Pos then PC_H.Color("SlopeUp") else if TSVmomentum_Neg then PC_L.Color("SlopeDown") else PC_H.Color("NoSlope"));
PC_H.SetLineWeight(2);
PC_H.HideBubble();

PC_L.DefineColor("SlopeUp", CreateColor(0, 153, 0));#createColor(0,153,0)); GREEN
PC_L.DefineColor("NoSlope", Color.GRAY);
PC_L.DefineColor("SlopeDown", Color.RED);
PC_L.AssignValueColor(if TSVmomentum_Pos then PC_L.Color("SlopeUp") else if TSVmomentum_Neg then PC_L.Color("SlopeDown") else PC_L.Color("NoSlope"));
PC_L.SetLineWeight(2);
PC_L.HideBubble();

# MOXIE - This section is for the medium term MACD ---------------------------------------------
def midTermFastAvg = ExpAverage(close(period = Moxie_lowestAggregation), 12);
def midTermSlowAvg = ExpAverage(close(period = Moxie_lowestAggregation), 26);
def midTermValue = midTermFastAvg - midTermSlowAvg;
def midTermAvg = ExpAverage(midTermValue, 9);
def midTermDiff = (midTermValue - midTermAvg)*3;

# MOXIE - This section is for the long term MACD -----------------------------------------------
def longTermFastAvg = ExpAverage(close(period = Moxie_highestAggregation), 12);
def longTermSlowAvg = ExpAverage(close(period = Moxie_highestAggregation) , 26);
def longTermValue = longTermFastAvg - longTermSlowAvg;
def longTermAvg = ExpAverage(longTermValue, 9);
def longTermDiff = (longTermValue - longTermAvg)*3;

# Signal Criteria -----------------------------------------------------------------------
def midTermLower = midTermDiff < 0 and midTermDiff < midTermDiff[1];
def midTermHigher = midTermDiff > 0 and midTermDiff > midTermDiff[1];

def longTermLower = longTermDiff < 0 and longTermDiff < longTermDiff[1];
def longTermHigher = longTermDiff > 0 and longTermDiff > longTermDiff[1];

#########################################################################
plot BuySignal = if midTermHigher and LongTermHigher then MovAvg_L1x else Double.NaN;
BuySignal.SetDefaultColor (Color.White); #(CreateColor(0, 153, 0));
BuySignal.SetPaintingStrategy(PaintingStrategy.POINTS);
BuySignal.SetLineWeight(2);
BuySignal.HideBubble();
BuySignal.HideTitle();

plot SellSignal = if midTermLower and LongTermLower then MovAvg_H1x else Double.NaN;
SellSignal.SetDefaultColor(Color.White);
SellSignal.SetPaintingStrategy(PaintingStrategy.POINTS);
SellSignal.SetLineWeight(2);
SellSignal.HideBubble();
SellSignal.HideTitle();

# Cloud Fill -----------------------------
AddCloud(MovAvg_H, MovAvg_L, Color.LIGHT_GRAY);

alert (close>BuySignal,"ChannelDotup", alert.bar,Sound.ding);
alert (close<SellSignal,"ChannelDotdown", alert.bar,Sound.ding);

#alert (close>BuySignal,"ChannelDotup", alert.once,Sound.ding);
#alert (close<SellSignal,"ChannelDotdown", alert.once,Sound.ding);
MUCHO THANKS, I'M USING THE MOXIE CHANNEL ALONG WITH THE MOXIE LOWER.
 
@Slippage in regards to post #209, did you say you were going to write or update the code for that post? I love the smooth Moxie line, much easier on the eyes. Thank you very much.
 
@Slippage in regards to post #209, did you say you were going to write or update the code for that post? I love the smooth Moxie line, much easier on the eyes. Thank you very much.

Squeeze is in both versions now, as of whatever time I posted that reply.

Be careful with the smooth version. Most of the time it looks like it reasonably matches the stair-steps but once in a while the two indicators cross zero a little apart from each other and I noticed today during market hours that sometimes they look like they're doing completely different things on the newest candle. I'll be running both for quite a while I think, until I get a feel for which I trust more.
 
Squeeze is in both versions now, as of whatever time I posted that reply.

Be careful with the smooth version. Most of the time it looks like it reasonably matches the stair-steps but once in a while the two indicators cross zero a little apart from each other and I noticed today during market hours that sometimes they look like they're doing completely different things on the newest candle. I'll be running both for quite a while I think, until I get a feel for which I trust more.
This is the moxie lwr I am currently running.

 
@Slippage Thank you for the quick response and your interesting observations of the differences. I will stick with the stairsteps until hearing from you further.

I'm not sure I'll ever make a recommendation on which to use. I suspect they're going to both have pluses and minuses and which to choose will come down to personal preference.

As long as I'm in Mastery I'll probably keep the stair step version on my charts even if I eventually prefer the other. That way I can see what everyone else sees. It's not my intention to stay in there for many months, though. I find it beneficial to have a group chat while I'm learning a strategy but once I have some experience I trade better without distractions.
 
For anyone considering purchasing any Moxie stuff, Simpler Trading keeps increasing the prices. If you're serious about it you're probably better off doing it soon rather than waiting. I noticed today the package I paid $997 for just over a week ago is now $1197. If you were looking at a package last week and you remember what that price was it might be worth calling them and trying to get that price now.

So far, since I joined Mastery, TG hasn't called any trades except an optional add to an SLV position they were already in which went south two days after he called the add. He has live trading sessions for Mastery and for one or two classes this week. It sounds like Mastery members do not get alerts for the trades he takes live with the classes. Other Mastery members, please correct me if I'm wrong. I don't care that much, since my goal isn't to trade his alerts forever, but it does kind of rub me the wrong way. I thought I was paying for alerts on his trades, not paying for alerts on his trades except ones he takes Wednesdays and Thursdays or whatever days. It's not like sharing those trades with Mastery members takes anything away from the classes.

Regarding TG's fear of shorting, I think I caught the root cause of that in one of his videos. He was showing a stock in an uptrend and saying he doesn't like to short because "it has all these levels of support it can bounce from" while pointing to the moving averages. I don't know why it doesn't occur to him he just needs to reverse his criteria to look for a clear path down the same as he looks for a clear path up to go long. There are stocks already below their daily MAs and some below the weekly and monthly MAs as well.
 
heres a fun way to look at things, if you push the moxie forward and backwards you can create the same effect that an ichimoku might produce when theres a cross over the cloud and the setpack of price, i tried different settings and so far 34 has been the best.

Code:
declare lower;

input showVerticalLines = yes;
input showTrampolines = yes;
input showSqueezeDots = no;
input showLabel = yes;

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.GRAY);
ZeroLine.SetLineWeight(2);
ZeroLine.HideBubble();
ZeroLine.HideTitle();

def currentAggPeriod = GetAggregationPeriod();
def multiplier =
  if currentAggPeriod <= AggregationPeriod.TWO_MIN then AggregationPeriod.FIVE_MIN / currentAggPeriod
  else if currentAggPeriod <= AggregationPeriod.THREE_MIN then AggregationPeriod.TEN_MIN / currentAggPeriod
  else if currentAggPeriod <= AggregationPeriod.FIVE_MIN then AggregationPeriod.FIFTEEN_MIN / currentAggPeriod
  else if currentAggPeriod <= AggregationPeriod.TEN_MIN then AggregationPeriod.THIRTY_MIN / currentAggPeriod
  else if currentAggPeriod <= AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.HOUR / currentAggPeriod
  else if currentAggPeriod <= AggregationPeriod.THIRTY_MIN then AggregationPeriod.TWO_HOURS / currentAggPeriod
  else if currentAggPeriod <= AggregationPeriod.HOUR then 7
  else if currentAggPeriod <= AggregationPeriod.TWO_HOURS then 3
  else if currentAggPeriod <= AggregationPeriod.FOUR_HOURS then 3 # yes, weird, but this matches better
  else if currentAggPeriod <= AggregationPeriod.DAY then 5
  else if currentAggPeriod <= AggregationPeriod.WEEK then AggregationPeriod.MONTH / currentAggPeriod
  else AggregationPeriod.QUARTER / currentAggPeriod
;

script MoxieFunc {
  input factor = 1;
  def v = ExpAverage(close, 12*factor) - ExpAverage(close, 26*factor);
  def a = ExpAverage(v, 9*factor);
  plot m = (v - a) * 3;
}

plot Moxie = MoxieFunc(multiplier)[34];
plot Moxie2 = MoxieFunc(multiplier)[-34];
Moxie.SetLineWeight(2);
Moxie.DefineColor("Up", Color.UPTICK);
Moxie.DefineColor("Down", Color.RED);
Moxie.AssignValueColor(
  if Moxie < Moxie[1] then Moxie.Color("Down")
  else Moxie.Color("Up")
);
Moxie.HideBubble();
Moxie.HideTitle();

# Watkins uses a different setup for Moxie on his 15 minute charts.
# He uses two lines derived from two higher timeframes.
def secondMultiplier =
  if currentAggPeriod == AggregationPeriod.FIFTEEN_MIN then 7
  else currentAggPeriod
;

plot MoxieSecondLine =
  if currentAggPeriod == AggregationPeriod.FIFTEEN_MIN
  then MoxieFunc(secondMultiplier)
  else Double.NaN
;

MoxieSecondLine.SetLineWeight(2);
MoxieSecondLine.DefineColor("Up", Color.UPTICK);
MoxieSecondLine.DefineColor("Down", Color.RED);
MoxieSecondLine.AssignValueColor(
  if MoxieSecondLine < MoxieSecondLine[1] then MoxieSecondLine.Color("Down")
  else MoxieSecondLine.Color("Up")
);
MoxieSecondLine.HideBubble();
MoxieSecondLine.HideTitle();
MoxieSecondLine.SetHiding(currentAggPeriod != AggregationPeriod.FIFTEEN_MIN);

# Show vertical lines at crossovers
AddVerticalLine(showVerticalLines and Moxie[1] crosses above 0, "", CreateColor(0,150,0), Curve.SHORT_DASH);
AddVerticalLine(showVerticalLines and Moxie[1] crosses below 0, "", CreateColor(200,0,0), Curve.SHORT_DASH);

# Indicate the Trampoline setup
def sma50 = Average(close, 50);
plot Trampoline =
  if showTrampolines and ((Moxie < -.01 and close > sma50) or (Moxie > .01 and close < sma50))
  then 0
  else Double.NaN
;
Trampoline.SetPaintingStrategy(PaintingStrategy.SQUARES);
Trampoline.DefineColor("Bullish", Color.LIGHT_GREEN);
Trampoline.DefineColor("Bearish", Color.PINK);
Trampoline.AssignValueColor(if close > sma50 then Trampoline.Color("Bearish") else Trampoline.Color("Bullish"));
Trampoline.HideBubble();
Trampoline.HideTitle();

# show squeeze dots on zero line
def squeezeLevel =
  if TTM_Squeeze(nK=1.0).SqueezeAlert == 0 then 3
  else if TTM_Squeeze(nK=1.5).SqueezeAlert == 0 then 2
  else if TTM_Squeeze(nK=2.0).SqueezeAlert == 0 then 1
  else 0
;

plot Squeeze = if !showSqueezeDots then Double.NaN else 0;
Squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
Squeeze.SetDefaultColor(Color.GRAY);
Squeeze.DefineColor("Loose Squeeze", Color.UPTICK);
Squeeze.DefineColor("Squeeze", Color.RED);
Squeeze.DefineColor("Tight Squeeze", Color.YELLOW);
Squeeze.DefineColor("No Squeeze", Color.GRAY);
Squeeze.AssignValueColor(
  if squeezeLevel == 3 then Squeeze.Color("Tight Squeeze")
  else if squeezeLevel == 2 then Squeeze.Color("Squeeze")
  else if squeezeLevel == 1 then Squeeze.Color("Loose Squeeze")
  else Squeeze.Color("No Squeeze")
);
Squeeze.HideTitle();
Squeeze.HideBubble();

AddLabel(
  showLabel,
  if currentAggPeriod == AggregationPeriod.WEEK then " W "
  else if currentAggPeriod == AggregationPeriod.DAY then " D "
  else if currentAggPeriod == AggregationPeriod.HOUR then " H "
  else if currentAggPeriod == AggregationPeriod.FIFTEEN_MIN then " 15 "
  else if currentAggPeriod == AggregationPeriod.FIVE_MIN then " 5 "
  else if currentAggPeriod == AggregationPeriod.TWO_MIN then " 2 "
  else " ",
  if Moxie < 0 then Color.RED else Color.GREEN
);

AddLabel(
  yes,
  if currentAggPeriod == AggregationPeriod.WEEK then " W "
  else if currentAggPeriod == AggregationPeriod.Day then " D "
  else if currentAggPeriod == AggregationPeriod.HOUR then " H "
  else if currentAggPeriod == AggregationPeriod.FIFTEEN_MIN then " 15 "
  else if currentAggPeriod == AggregationPeriod.FIVE_MIN then " 5 "
  else if currentAggPeriod == AggregationPeriod.TWO_MIN then " 2 "
  else " ",
  if Moxie < 0 then Color.RED else Color.GREEN
);
 
Running the moxie lwr smooth for two days and it seems to mirror my wave lines on the 10 min chart the shorter time frames have been profitable.

Nice. I've been running the upper with the candle coloring, not trading it but watching it. On 5m charts the arrows for zero line crossovers appear to be mostly useless but the color changes fit the trend pretty well. It was a bit indecisive on SPY until price bottomed out yesterday but clean from there.

2021-03-03-15-08-56-Window.png
 
Here's an example where the "smooth" Moxie and the "real" Moxie are doing very different things. I'll try to remember to follow up in a few days to see which seems more helpful.

2021-03-03-21-14-48-Window.png
 
@Slippage I see what you mean. Tracks a good chunk of it but big difference at the beginning and end of chart. What are the red down arrows above/green below the zero line?
 
What are the red down arrows above/green below the zero line?

That's my new way to show trampolines since I'm using squeeze dots on the zero line. It needs more work, though. The arrow tips cover the squeeze dots if I position the arrows at 0. So I have to offset them a bit. Moxie's range is different on every symbol and every timeframe so if I hard code a specific offset sometimes it's perfect, sometimes not enough and sometimes way too much. So, I changed it to calculate the offset dynamically. It's working better but still needs some tweaking.
 
@Fenway1353 In the live trading session today someone asked TG about scans. He said he rarely scans. He has his list of stocks he watches and that's it. If some other hot stock comes along he'll hear about it from us.
 
That's my new way to show trampolines since I'm using squeeze dots on the zero line. It needs more work, though. The arrow tips cover the squeeze dots if I position the arrows at 0. So I have to offset them a bit. Moxie's range is different on every symbol and every timeframe so if I hard code a specific offset sometimes it's perfect, sometimes not enough and sometimes way too much. So, I changed it to calculate the offset dynamically. It's working better but still needs some tweaking.
@Slippage. That is a great idea? Actually clearer than the trampoline dots. Please let me know when you have been satisfied with the observation results as I’d love to try the code when ready. I admire your sticktoitness.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
405 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