Repaints MTF Moxie Indicator for ThinkorSwim

Repaints
I have only watched 1 or 2 of his videos, so don't have anywhere as much depth of knowledge on his strategy as you, but from those I totally concur, particularly on squeeze. It seems Daily and above MAs are for key S/R and trends of higher TFs. But with focus on days-weeks investment, so getting good entries using hourly and 15min to optimize entries makes sense. He mentioned pulling trigger in last hour of day, so this would align too. One concept he mentioned wrt 15min that seemed interesting though was if the 1hr and 2hr moxies separate that this indicates weak move. I am looking into the math/stat's a bit to see if that holds up, since if it does that could be interesting as well. Cheers.
 
Last edited by a moderator:

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

I have only watched 1 or 2 of his videos, so don't have anywhere as much depth of knowledge on his strategy as you, but from those I totally concur, particularly on squeeze. It seems Daily and above MAs are for key S/R and trends of higher TFs. But with focus on days-weeks investment, so getting good entries using hourly and 15min to optimize entries makes sense. He mentioned pulling trigger in last hour of day, so this would align too. One concept he mentioned wrt 15min that seemed interesting though was if the 1hr and 2hr moxies separate that this indicates weak move. I am looking into the math/stat's a bit to see if that holds up, since if it does that could be interesting as well. Cheers.

Yes, he does often mention a strong preference for the two lines on 15m to be "in agreement" with each other. Another unknown I've been watching for is how far from zero should Moxie be for a trampoline setup to be valid or some other criteria for trampolines. You'll often see trampoline conditions as Moxie approaches the zero line to cross over and they fail quickly.
 
Funny you mention that as I have been noticing there are 2 points of interest, the trend turning point and the zero cross and the distance between the 2 (i.e distance from zero). Whether it is a trend reversal or a retracement/continuation makes a difference on this distance as does the strength of the move. The 2 15min aggregation TFs tend to differ in both regards depending on strength of the move. Divergence is quite easy to see as well due to the simple moxie line when compared to price action H/L's. I suspect that the trick is really not so much in analyzing this as into trying to gauge whether the combination of indications show a good chance of exploding and then let stats and the money mgmt of the strategy work things out (as long as you can pick enough exploders :)
 
Funny you mention that as I have been noticing there are 2 points of interest, the trend turning point and the zero cross and the distance between the 2 (i.e distance from zero). Whether it is a trend reversal or a retracement/continuation makes a difference on this distance as does the strength of the move. The 2 15min aggregation TFs tend to differ in both regards depending on strength of the move. Divergence is quite easy to see as well due to the simple moxie line when compared to price action H/L's. I suspect that the trick is really not so much in analyzing this as into trying to gauge whether the combination of indications show a good chance of exploding and then let stats and the money mgmt of the strategy work things out (as long as you can pick enough exploders :)

Another thing he's mentioned is when Moxie goes flat for an extended time while price continues trending you can expect a big move of price in the opposite direction. The two times I've seen this Moxie was hovering just below zero and refusing to cross as price climbed and both times price did come down fast.

For trend turning point, I've been experimenting a little bit with watching 2m Moxie while day trading on a 5m chart but I haven't put much time in it and I don't have a feel yet for if it's useful. You get an early indication of the change in direction but I don't see a way yet to get an early indication of whether it's a reversal or just a pullback. Ideally, though, I want to be done with day trading anyway and just swing. His "last hour" thing is appealing to me though that's currently 4am to 5am for me and when the US gets out of daylight savings it'll be 3am to 4am. If I pay for any training I'll wake up at those times to trade by the book for a while but I may transition to just entering off hours if it looks like it won't hurt my entries too much.

For stocks, his exit is when, on the hourly chart, both Moxie is below zero and price closes below 50 SMA. Options are a new thing for him and I don't know how he's managing those. I'm guessing a more aggressive exit like a fixed price target (1.272 and 1.618 fib targets are popular at Simpler Trading) or until some early sign of weakness.
 
Last edited by a moderator:
He does look at Moxie for divergence on weekly charts so it looks like we can't get rid of that timeframe by plotting its MAs in lower charts.
 
Great work Slippage. In one of TG's videos discussing his scanner, he has many studies that make up 1 scan (Moxie Crossover, Daily 50/200 SMA on/off, Hourly 50/200 SMA on/off, Monthly 10 SMA on/off, etc.) Does the scan you link to in this thread mimic that?
Like you, I've watched a lot of TG's videos, both from his days on his own at Moxie Trading and now with ST. I think finding the setups for the Moxie Method before it crosses above zero on the indicator to place on a watchlist would be beneficial. Is that possible? I guess I could pay for his Mastery Program but would like to hear your thoughts. Thanks again for the code - great job! All the best.
 
Last edited:
I suspect that you might be a bit disappointed wrt to finding out about the subtleties, as I think that as you say, they may not be mathemagicians :)

So keep in mind that what OsMA is really doing is looking at the slope of two MAs, and when the ave OsMA trend is down and the 2 MAs are Converging the moxie/OsMA line is up (and visa versa for ave OsMA trend up), and when the fast MA has moved up enough it will cross the trailing ave of the MA difference (ie crosses zero). This trend of slope is why the price divergence is so easy to spot.

By using HTFs, it also smooths out the per bar variations by presenting a stair step line (but thus the most recent step will also repaint up until the HTF bar closes).
 
Last edited by a moderator:
Great work Slippage. In one of TG's videos discussing his scanner, he has many studies that make up 1 scan (Moxie Crossover, Daily 50/200 SMA on/off, Hourly 50/200 SMA on/off, Monthly 10 SMA on/off, etc.) Does the scan you link to in this thread mimic that?
Like you, I've watched a lot of TG's videos, both from his days on his own at Moxie Trading and now with ST. I think finding the setups for the Moxie Method before it crosses above zero on the indicator to place on a watchlist would be beneficial. Is that possible? I guess I could pay for his Mastery Program but would like to hear your thoughts. Thanks again for the code - great job! All the best.
Finding the setups before it crosses zero would be possible. You could do it by having a threshold crossed that is above/below zero for below/above zero Moxie lines (and likely a bit of hysteresis to reduce thrashing), or parameters could be added to allow the adjustment of the MA periods to speed it up a bit, eg 7/21/9 vs 12/26/9 etc. There are other ways too...
 
Great work Slippage. In one of TG's videos discussing his scanner, he has many studies that make up 1 scan (Moxie Crossover, Daily 50/200 SMA on/off, Hourly 50/200 SMA on/off, Monthly 10 SMA on/off, etc.) Does the scan you link to in this thread mimic that?
Like you, I've watched a lot of TG's videos, both from his days on his own at Moxie Trading and now with ST. I think finding the setups for the Moxie Method before it crosses above zero on the indicator to place on a watchlist would be beneficial. Is that possible? I guess I could pay for his Mastery Program but would like to hear your thoughts. Thanks again for the code - great job! All the best.

The scan code I posted in this thread is only the Moxie piece. I didn't link any shared scans nor do I plan to.

I saw the scan in the video you're talking about, I think in the Moxie Trader channel, when he was excited that he now finally has a scan. That made me seriously doubt whether he even created Moxie since turning it into a scan is simple and took me about 5 seconds. His scan piqued my interest at the time but I didn't try to copy it. Instead, I created a scan that filters for the criteria I hear him talking about all the time. My scan has 6 sections.
1. On monthly, close is above 10 SMA
2. On monthly, Moxie is above -0.2 (this is equivalent to the weekly chart)
3. On weekly, Moxie is above -0.2 (this is equivalent to the daily chart)
4. On weekly, close is above 8/21 EMA and 30/50 SMA and 8 is above 21
5. On daily, close is above 50 SMA
6. On hourly, close is above 50/200 SMA and price traded within one third ATR of the 50 SMA

I run this scan with "Scan in" set to a another scan that has my minimum requirements for stocks I'd consider for a swing -- average volume and things like that.

You can see I gave Moxie a little wiggle room with above -0.2 instead of above 0 in case it's about to cross. I need more experience with Moxie before I can know if that wiggle room helps or hurts.

I doubt his scan filters out stocks that aren't near the hourly 50 SMA. Having that filter is helpful to not waste time looking at stocks that need a pullback to the 50 before they should be traded. And it eliminates stocks that already took off and shouldn't be chased. Even though he only executes trades in the last hour of the day I get the impression he spends a lot of hours looking at charts and waiting for them to set up. I'd rather not see them until they're almost ready for entry. Once I have more experience with it I may add filters for the 15m criteria as well, to get only stocks that are truly ready to trade immediately.

I considered adding filters to get rid of stocks that are just below monthly 50/200 SMA, weekly 200 SMA or daily 200 SMA but he does trade those on their second attempt to pass those resistances so I didn't filter them out.

I originally created scans for the crosses above/below zero. Then I watched the videos to learn the strategy and discovered the crossover generally is not the time to enter a trade so I don't see those scans as useful.

Lastly, I haven't been trading any of this yet so I'm no expert. I did enter a couple of orders yesterday, based on this Moxie stuff, to execute Monday if my stop-limits are hit. My scan may change as I learn more either through experience or paying for training.
 
@Slippage Hard for me to say. I wouldn't rewrite the code you originally posted now that you have access to the official Moxie indicator. That would be considered piracy.
 
@Slippage Hard for me to say. I wouldn't rewrite the code you originally posted now that you have access to the official Moxie indicator. That would be considered piracy.
Alright. Here's what I'm thinking... I'm going to make two tweaks to the code I posted previously as a new post. That way the original dates are still on the code I posted before and if Simpler ever comes at us we can show that code was here before I signed up with them. So please don't nuke my earlier post even though it's obsolete and redundant. One of the tweaks isn't relevant to their code anyway since theirs doesn't handle multiple timeframes but the fix for the 15m timeframe is.
 
Last edited:
Hopefully this will be the final code. The code for the scans have not changed since they were posted earlier. I just wanted to bring all the pieces together in this post as the (hopefully) final and complete package.

1. This resolves a bug for 15m. It should use close price rather than high price.
2. This makes it so the second line is shown by default on 15m and no other timeframes. I changed this to stop the confusion some members ran into with why the second line didn't appear automatically on 15m.

Moxie Upper:
Ruby:
declare upper;

def currentAggPeriod = GetAggregationPeriod();
def higherAggPeriod =
  if currentAggPeriod <= AggregationPeriod.TWO_MIN then AggregationPeriod.FIVE_MIN
  else if currentAggPeriod <= AggregationPeriod.THREE_MIN then AggregationPeriod.TEN_MIN
  else if currentAggPeriod <= AggregationPeriod.FIVE_MIN then AggregationPeriod.FIFTEEN_MIN
  else if currentAggPeriod <= AggregationPeriod.TEN_MIN then AggregationPeriod.THIRTY_MIN
  else if currentAggPeriod <= AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.HOUR
  else if currentAggPeriod <= AggregationPeriod.THIRTY_MIN then AggregationPeriod.TWO_HOURS
  else if currentAggPeriod <= AggregationPeriod.TWO_HOURS then AggregationPeriod.DAY
  else if currentAggPeriod <= AggregationPeriod.FOUR_HOURS then AggregationPeriod.TWO_DAYS
  else if currentAggPeriod <= AggregationPeriod.DAY then AggregationPeriod.WEEK
  else if currentAggPeriod <= AggregationPeriod.WEEK then AggregationPeriod.MONTH
  else AggregationPeriod.QUARTER
;

script MoxieFunc {
  input price = close;
  def vc1 = ExpAverage(price, 12) - ExpAverage(price , 26);
  def va1 = ExpAverage(vc1, 9);
  plot data = (vc1 - va1) * 3;
}

def Moxie = MoxieFunc(close(period = higherAggPeriod));

def longTrigger = if Moxie > 0 and Moxie[1] <= 0 then Moxie else Double.NaN;
def longArrowPosition =
  # first arrow
  if Moxie == longTrigger and Moxie != Moxie[1] then low
  # consecutive arrows at same position
  else if Moxie == longTrigger and Moxie == Moxie[1] then longArrowPosition[1]
  else Double.NaN;
plot long = longArrowPosition;
long.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
long.SetDefaultColor(Color.GREEN);
long.SetLineWeight(3);
long.HideBubble();
long.HideTitle();

def shortTrigger = if Moxie < 0 and Moxie[1] >= 0 then Moxie else Double.NaN;
def shortArrowPosition =
  # first arrow
  if Moxie == shortTrigger and Moxie != Moxie[1] then high
  # consecutive arrows at same position
  else if Moxie == shortTrigger and Moxie == Moxie[1] then shortArrowPosition[1]
  else Double.NaN;
plot short = shortArrowPosition;
short.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
short.SetDefaultColor(Color.LIGHT_RED);
short.SetLineWeight(3);
short.HideBubble();
short.HideTitle();

Moxie Lower:
Ruby:
declare lower;

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

plot ZeroLine = if !IsNaN(open) and !showSqueezeDots then 0 else Double.NaN;
ZeroLine.SetDefaultColor(Color.GRAY);
ZeroLine.SetLineWeight(2);
ZeroLine.HideBubble();
ZeroLine.HideTitle();

def currentAggPeriod = GetAggregationPeriod();
def higherAggPeriod =
  if currentAggPeriod <= AggregationPeriod.TWO_MIN then AggregationPeriod.FIVE_MIN
  else if currentAggPeriod <= AggregationPeriod.THREE_MIN then AggregationPeriod.TEN_MIN
  else if currentAggPeriod <= AggregationPeriod.FIVE_MIN then AggregationPeriod.FIFTEEN_MIN
  else if currentAggPeriod <= AggregationPeriod.TEN_MIN then AggregationPeriod.THIRTY_MIN
  else if currentAggPeriod <= AggregationPeriod.FIFTEEN_MIN then AggregationPeriod.HOUR
  else if currentAggPeriod <= AggregationPeriod.THIRTY_MIN then AggregationPeriod.TWO_HOURS
  else if currentAggPeriod <= AggregationPeriod.TWO_HOURS then AggregationPeriod.DAY
  else if currentAggPeriod <= AggregationPeriod.FOUR_HOURS then AggregationPeriod.TWO_DAYS
  else if currentAggPeriod <= AggregationPeriod.DAY then AggregationPeriod.WEEK
  else if currentAggPeriod <= AggregationPeriod.WEEK then AggregationPeriod.MONTH
  else AggregationPeriod.QUARTER
;

script MoxieFunc {
  input price = close;
  def vc1 = ExpAverage(price, 12) - ExpAverage(price , 26);
  def va1 = ExpAverage(vc1, 9);
  plot data = (vc1 - va1) * 3;
}

plot Moxie = MoxieFunc(close(period = higherAggPeriod));
Moxie.SetLineWeight(2);
Moxie.DefineColor("Up", Color.GREEN);
Moxie.DefineColor("Down", Color.RED);
def lastChange = if Moxie < Moxie[1] then 1 else 0;
Moxie.AssignValueColor(
  if lastChange == 1 then Moxie.Color("Down")
  else Moxie.Color("Up")
);

# Watkins uses a different setup for Moxie on his 15 minute charts.
# He uses two lines derived from two higher timeframes.
# For timeframes other than 15 minutes we'll use the same data as
# first Moxie line to reduce data requested from the server and
# improve performance.
def secondAggPeriod =
  if currentAggPeriod == AggregationPeriod.FIFTEEN_MIN
  then AggregationPeriod.TWO_HOURS
  else currentAggPeriod
;

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

MoxieSecondLine.SetLineWeight(2);
MoxieSecondLine.DefineColor("Up", Color.GREEN);
MoxieSecondLine.DefineColor("Down", Color.RED);
def lastChangeSecondLine = if MoxieSecondLine < MoxieSecondLine[1] then 1 else 0;
MoxieSecondLine.AssignValueColor(
  if lastChangeSecondLine == 1 then MoxieSecondLine.Color("Down")
  else MoxieSecondLine.Color("Up")
);
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 bb = reference BollingerBands.LowerBand;
def squeezeLevel = 
  if bb > KeltnerChannels(factor = 1.0).Lower_Band then 3
  else if bb > KeltnerChannels(factor = 1.5).Lower_Band then 2
  else if bb > KeltnerChannels(factor = 2.0).Lower_Band then 1
  else 0
;

plot Squeeze = if !showSqueezeDots then Double.NaN else if !IsNaN(open) then 0 else Double.NaN;
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.SetLineWeight(2);
Squeeze.HideTitle();
Squeeze.HideBubble();

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
);

Trigger scan:
Ruby:
# because Moxie calculates from higher time frame
# to find daily entries, run this scan on weekly
# to find hourly entries, run this on daily
script Moxie {
    input priceC = close;
    def vc1 = ExpAverage(priceC , 12) - ExpAverage(priceC , 26);
    def va1 = ExpAverage(vc1, 9);
    plot sData = (vc1 - va1) * 3;
}
def m = Moxie();
def moxieUpArrow = m > 0 and m[1] <= 0;
plot scan = moxieUpArrow within 1 bars;

Trampoline scan from @Sneaky_Swings earlier in this thread:
Ruby:
# because Moxie calculates from higher time frame
# to find daily entries, run this scan on weekly
# to find hourly entries, run this on daily

def ap1 = close;

script MoxieFunc {
    input priceC = close;
    def vc1 = ExpAverage(priceC , 12) - ExpAverage(priceC , 26);
    def va1 = ExpAverage(vc1, 9);
    plot sData = (vc1 - va1) * 3;
}

def price = close;
def s2 = MoxieFunc(price);

def ZeroLine = 0;
def Moxie = s2;

# Indicate the Trampoline setup
def sma50 = SimpleMovingAvg(close, 50);

plot trampoline = (Moxie > 0.1 and close < sma50);

EDIT 3/1/21 to add squeeze dots on zero line
 
Last edited:
Yes, he does often mention a strong preference for the two lines on 15m to be "in agreement" with each other. Another unknown I've been watching for is how far from zero should Moxie be for a trampoline setup to be valid or some other criteria for trampolines. You'll often see trampoline conditions as Moxie approaches the zero line to cross over and they fail quickly.
Hi Slippage, thank you for the code. I m still learning how to use the indicator n had watched some of the videos. Is it common to have the moxie indicator above zeros on the hourly (per your code) but below the zero on the 15min chart?
& also how do i use the 2nd plot on the 15m? does that serve as a confirmation for the 1st plot on the 15min?
 
Is it common to have the moxie indicator above zeros on the hourly (per your code) but below the zero on the 15min chart?
& also how do i use the 2nd plot on the 15m? does that serve as a confirmation for the 1st plot on the 15min?

Yes, it's normal that Moxie is in different states on different timeframes.

For the 2 lines on 15m, he says when they are pretty close together, "in agreement with each other," you can trust whatever they are signaling and if they are wide apart it's probably a false signal.

You can learn both of these answers and other parts of his strategy from his YouTube videos in the Simpler Trading channel and in the Moxie Trader channel.
 
I think the most challenging aspect of this indicator is the scan. Does TG talk about that at all or is it discussed in the chat?

Sorry, @Fenway1353, I didn't realize you're still not comfortable building a scan with the steps I posted. Here's the code for the individual pieces of the scan I created. This scan isn't looking for triggers and won't find trampolines. It's looking for stocks that are almost ready to trade with normal, non-trampoline, setups regardless of how long ago Moxie crossed over.

For each of these pieces, add a new study filter to the scan, set the timeframe as listed here and paste the code.

1. Set to 1H. This handles the 1 hour moving averages.
This code could be simplified but I originally was just requiring price touched near 50 with or without closing above and I wanted to keep this easy to modify in case I want to change it back.
Ruby:
# near and close above 50
# close above 200
def range = reference ATR / 3;

def sma50 = Average(close, 50);
def near50 = Between(sma50, low - range, high + range);

def sma200 = Average(close, 200);

plot scan = near50 and close > sma50 and close > sma200;

2. Set to D. This makes sure we closed above the daily SMA 50.
Ruby:
close > Average(close, 50)

3. Set to W. This checks whether Moxie is above 0 on the daily chart.
Ruby:
# weekly for daily moxie
input price = close;
def vc1 = ExpAverage(price, 12) - ExpAverage(price , 26);
def va1 = ExpAverage(vc1, 9);
def moxie = (vc1 - va1) * 3;

plot scan = moxie > 0;

4. Set to W. This handles the weekly moving averages.
Ruby:
# weekly MA
def ema8 = ExpAverage(close, 8);
def ema21 = ExpAverage(close, 21);
def sma30 = Average(close, 30);
def sma50 = Average(close, 50);

plot scan =
  close > sma50
  and close > sma30
  and close > ema21
  and close > ema8
  and ema8 > ema21
;

5. Set to M. This checks whether Moxie is above 0 on the weekly chart.
Ruby:
# monthly for weekly moxie
input price = close;
def vc1 = ExpAverage(price, 12) - ExpAverage(price , 26);
def va1 = ExpAverage(vc1, 9);
def moxie = (vc1 - va1) * 3;

plot scan = moxie > 0;

6. Set to M. This makes sure we're above 10 SMA on monthly chart.
Ruby:
# month 10 sma
Average(close, 10) < close

7. Set to D. This checks whether Moxie is above 0 on the hourly chart.
Ruby:
# daily for hourly moxie
input price = close;
def vc1 = ExpAverage(price, 12) - ExpAverage(price , 26);
def va1 = ExpAverage(vc1, 9);
def moxie = (vc1 - va1) * 3;

plot scan = moxie > 0;

As I noted earlier in this thread, my "Scan in" is set to a different scan where I have criteria for average volume, price, etc. You can add average volume and such to this scan if you don't want a separate scan. If you only trade end of day then you can probably just scan for volume instead of average volume.
 
Last edited:
Yes, it's normal that Moxie is in different states on different timeframes.

For the 2 lines on 15m, he says when they are pretty close together, "in agreement with each other," you can trust whatever they are signaling and if they are wide apart it's probably a false signal.

You can learn both of these answers and other parts of his strategy from his YouTube videos in the Simpler Trading channel and in the Moxie Trader channel.
Thank you Slippage. Appreciate.
 
@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);
I have been looking at this indicator all day to see if the "slopeUp" and "SlopeDown" repaint, but I am not seeing any signs. Can you confirm if they do or not? I understand the buy signals may repaint because of the aggregation periods, but im only interested in the slope. I program a lot of indicators, but the "If (.01 <> 0, (1 / 0.01), 0);" is throwing me off.

EDIT:
It looks like the indicator does repaint, but it only repaints as far as the price channel length.
 
Last edited:
I have been looking at this indicator all day to see if the "slopeUp" and "SlopeDown" repaint, but I am not seeing any signs. Can you confirm if they do or not? I understand the buy signals may repaint because of the aggregation periods, but im only interested in the slope. I program a lot of indicators, but the "If (.01 <> 0, (1 / 0.01), 0);" is throwing me off.

EDIT:
It looks like the indicator does repaint, but it only repaints as far as the price channel length.

Yes, it repaints until the higher timeframe closes. So on daily it repaints during all of the current week. Once the week closes it starts the next week of repainting and past weeks remain static.
 
Sorry, @Fenway1353, I didn't realize you're still not comfortable building a scan with the steps I posted. Here's the code for the individual pieces of the scan I created. This scan isn't looking for triggers and won't find trampolines. It's looking for stocks that are almost ready to trade with normal, non-trampoline, setups regardless of how long ago Moxie crossed over.

For each of these pieces, add a new study filter to the scan, set the timeframe as listed here and paste the code.

1. Set to 1H. This handles the 1 hour moving averages.
@Slippage I really appreciate you taking the time to write out the scans. The way you laid it out was easy to input into TOS. Thanks again.

I took a look at a few other videos today. I noticed TG primarily uses the hourly and commonly enters trades when the Moxie Indicator goes positive on the hourly. I noticed on the posted scan that the Moxie Indicator is already positive. Do you think it's beneficial to include the situations where the indicator is just below zero so that the trade can potentially be entered as it crosses above.

Again, thanks for all you continue to do. Please don't take the above as criticism - I used the scanner all day and loved it. I was just thinking of a way to ensure we don't miss a potential entry point when the Moxie Indicator goes positive on the hourly.

Thanks again!
 
Yes, it repaints until the higher timeframe closes. So on daily it repaints during all of the current week. Once the week closes it starts the next week of repainting and past weeks remain static.
@Slippage First and foremost, thank you for all your efforts.. they are truly appreciated.

I am not a coder so please forgive the nature of the question. Is it possible to have the indicator not repaint? Is there a minor code change I can make for that? Or is this not possible given the core nature of the indicator?

Thanks
 

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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