Moxie Indicator for ThinkorSwim

Thank you for clarification. So how do we use above indicator and on which timeframe it works ?
This is the link provided on page 1 of this post about the indicator. This is just like any oscillator and the idea behind this (as is the case with most indicators now) is to set it for a higher timeframe or use it on multiple timeframes to help trade with the trend and find appropriate entries.

https://www.simplertrading.com/move-replay/
 

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

My attempt at maxing the color match

Code:
#START OF Moxie Salty Port for ThinkOrSwim
#
#CHANGELOG
# 2020.10.02 V1.0 @diazlaz Initial Port Release
#                 Request @madpuri
#
#CREDITS
# markmiotke
#
#LINK
# https://www.tradingview.com/script/mssQsys9-Moxie-Arrows-Salty/
#
#USAGE
#

declare lower;

def AP = GetAggregationPeriod();

def ap1;
if (AP == AggregationPeriod.MIN) {
    ap1 = AggregationPeriod.FIVE_MIN;
}
else if (AP == AggregationPeriod.THREE_MIN) {
    ap1 = AggregationPeriod.FIVE_MIN;
}
else if (AP == AggregationPeriod.FIVE_MIN) {
    ap1 = AggregationPeriod.FIFTEEN_MIN;
}
else if (AP == AggregationPeriod.FIFTEEN_MIN) {
    ap1 = AggregationPeriod.THIRTY_MIN;
}
else if (AP == AggregationPeriod.THIRTY_MIN) {
    ap1 = AggregationPeriod.HOUR;
}
else if (AP == AggregationPeriod.HOUR) {
    ap1 = AggregationPeriod.DAY;
}
else if (AP == AggregationPeriod.TWO_HOURS) {
    ap1 = AggregationPeriod.DAY;
}
else if (AP == AggregationPeriod.FOUR_HOURS) {
    ap1 = AggregationPeriod.DAY;
}
else if (AP == AggregationPeriod.DAY) {
    ap1 = AggregationPeriod.WEEK;
}
else if (AP == AggregationPeriod.WEEK) {
    ap1 = AggregationPeriod.MONTH;
}
else {
    ap1 = AggregationPeriod.DAY;
}

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

def price = close(period = ap1);
def s2 = Moxie(price);

plot ZeroLine = 0;
plot pMoxie = s2;
pMoxie.SetLineWeight(2);
pMoxie.DefineColor("Positive and Up", Color.GREEN);
pMoxie.DefineColor("Positive and Down", Color.RED);
pMoxie.DefineColor("Negative and Down", Color.RED);
pMoxie.DefineColor("Negative and Up", Color.GREEN);
pMoxie.AssignValueColor(if pMoxie > pMoxie[1] then pMoxie.Color("Positive and Up") else if pMoxie == pMoxie[1] and pMoxie[1] > pMoxie[2] then pMoxie.Color("Positive and Up") else if pMoxie == pMoxie[1] and pMoxie[2] > pMoxie[3] then pMoxie.Color("Positive and Up") else if pMoxie == pMoxie[1] and pMoxie[3] > pMoxie[4] then pMoxie.Color("Positive and Up") else if pMoxie == pMoxie[1] and pMoxie[4] > pMoxie[5] then pMoxie.Color("Positive and Up") else if pMoxie == pMoxie[1] and pMoxie[4] < pMoxie [5] then  pMoxie.Color("Positive and Down") else if pMoxie == pMoxie[1] and pMoxie[5] > pMoxie[6] then pMoxie.Color("Positive and Up") else if pMoxie == pMoxie[1] and pMoxie[6] > pMoxie[7] then pMoxie.Color("Positive and Up") else if pMoxie <= pMoxie[1] then pMoxie.Color("Negative and Down") else pMoxie.Color("Negative and Up"));


#END OF Moxie Salty Port for ThinkOrSwim
 
@Ramesh16 This scans for the Moxie indicator w/o any of the multiple aggregation periods.

Link to scan: http://tos.mx/YEmcyTU

Code:
#Moxie Salty Port for ThinkOrSwim SCANNER VERSION ONLY
# 2020.10.02 V1.0 @diazlaz
script Moxie {
    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 = Moxie(price);

plot moxieUpArrow = (Sign (s2 - s2[1]) > Sign (s2[1] - s2[2]));
#plot moxieDownArrow = (Sign (s2 - s2[1]) < Sign (s2[1] - s2[2]));

aaa2.png
 
Yes, Thank you Merry Day. I was wondering if you knew how to create your scan (or any scan) using this thread's script to look for Moxie when it is above zero (or below). Greatly helpful.
 
@greg44

There are a couple of studies in this thread but if you are using the one listed in Post#29 by @diazlaz
wouldn't you just scan for:
NameOfYourStudy()."pMoxie" > 0 or NameOfYourStudy()."pMoxie" < 0

Did you get some sort of error when you made the attempt?
And aren't you going to get every stock in the universe in your results? Aren't almost all stocks above or below zero?
 
Thanks for getting back. Just doing two separate scans either above or below zero. No, when I tried the "pMoxie" > 0, I get "Secondary period not allowed: Weekly. Ideally I am trying to do on an hourly time frame but still get "secondary period not allowed: Day."
 
Last edited:
Sorry @greg44
I forgot about that pesky "secondary period not allowed: Day."
Here is your scan:
Code:
#Moxie Salty Port for ThinkOrSwim SCANNER VERSION ONLY
# 2020.10.02 V1.0 @diazlaz
script Moxie {
    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 = Moxie(price);
plot pMoxie = s2 ;

plot moxieUpArrow = (Sign (s2 - s2[1]) > Sign (s2[1] - s2[2]));
#plot moxieDownArrow = (Sign (s2 - s2[1]) < Sign (s2[1] - s2[2]));
 
Thank you MerryDay! That appears to work. Yes those secondary periods are pesky. Quickly, what in your code would I change to make Moxie < 0?
You have been tremendously helpful.
 
My bad MerryDay. Stupid on my part. Apologies.
Are you familiar with the JC RAF indicator? I had a question on a different thread awaiting an answer.

Thanks again MerryDay. I am finding that TOS many times doesn't read the scan as is meant since many of the stocks that I have as >0 still come up below 0, even if that is the only thing I have in a scan, no matter the period I choose. Probably a deficiency in TOS scanning capabilities.
I have been using the post #56 script if that makes a difference. Shows the change in color as Moxie rises or declines.
 
@greg44 One thing to remember is that if you run a scan after hours the price may have changed from the close of the trading day... That could explain differences or, as you explained it, deficiencies...
 
Hi @cos251, anyway to apply this to a scanner so I can plot as the red or green arrows are beginning on daily chart and mtf? Thanks.
Hi @Joseph Patrick 18 - the code in post #63 should work for scans. You won't be able to use the MTF version of the indicator for scans as that will result in a "too complex error". But you can setup up the scan in 63 as multiple filters and scan each time frame.
 
I've downloaded and tested the Moxie Salty Port indicator which works just great (WOW) for Daily and Hourly.
The 15 minute does not lined as well.
Has anyone ever figured out how TG uses the Moxie indicator on the 15 minute chart?


Thanks a bunch
 
I have tried the scan in post #63, but I get "Exactly one plot expected" when I create it in thinkscript in a scan and thus cannot save it. . Any ideas? Thanks.
 
4Vej5X.jpg


Thought I'd add my three cents, or Three Time Frames to this "Mooxie" Indicator. Haha! Adjustable as needed within the study.
Hope someone likes the sharing :)

Code:
#START OF Mooxie for ThinkOrSwim
#Fair disclosure, lots of others on the web contributed to much of the original code.
#Adjustments were made to simplify it. And changes can be made to customize this.

declare lower;
input aggPeriod = AggregationPeriod.DAY;
script Mooxie {
    input priceC = close;
    def vc1 = ExpAverage(priceC , 12) - ExpAverage(priceC , 26);
    def va1 = ExpAverage(vc1, 9);
    plot sData = (vc1 - va1) * 3;}
def priceMooxie = close(period = aggPeriod);
def s2 = Mooxie(priceMooxie);
rec mooxieFT = CompoundValue(1, 0.5 * (Log((1 + s2) / (1 - s2)) + mooxieFT[1]), 0);
Plot zero = 0;
zero.setDefaultColor(Color.RED);
###FIRST TIME FRAME###
plot MooxiePlot = s2; # Plot InverseFT Moxie
MooxiePlot.SetPaintingStrategy(PaintingStrategy.LINE);
MooxiePlot.SetLineWeight(1);
MooxiePlot.DefineColor("Positive and Up", Color.GREEN);
MooxiePlot.DefineColor("Positive and Down", Color.GREEN);
MooxiePlot.DefineColor("Negative and Down", Color.GREEN);
MooxiePlot.DefineColor("Negative and Up", Color.GREEN);
MooxiePlot.AssignValueColor(if s2 >= 0 then if s2 > s2[1] then MooxiePlot.color("Positive and Up") else MooxiePlot.color("Positive and Down") else if s2 < s2[1] then MooxiePlot.color("Negative and Down") else MooxiePlot.color("Negative and Up"));
### SECOND TIME FRAME###
input aggPeriod2 = AggregationPeriod.THREE_DAYS;
script Moxie2 {
    input priceC2 = close;
    def vc1B = ExpAverage(priceC2 , 12) - ExpAverage(priceC2 , 26);
    def va1B = ExpAverage(vc1B, 9);
    plot sData2 = (vc1B - va1B) * 3;}
def priceMooxie2 = close(period = aggPeriod2);
def s2B = Mooxie(priceMooxie2);
rec mooxieFTB = CompoundValue(1, 0.5 * (Log((1 + s2B) / (1 - s2B)) + mooxieFTB[1]), 0);
plot MooxiePlot2 = s2B; # Plot InverseFT Mooxie
MooxiePlot2.SetPaintingStrategy(PaintingStrategy.LINE);
MooxiePlot2.SetLineWeight(1);
MooxiePlot2.DefineColor("Positive and Up", Color.DARK_ORANGE);
MooxiePlot2.DefineColor("Positive and Down", Color.DARK_ORANGE);
MooxiePlot2.DefineColor("Negative and Down", Color.DARK_ORANGE);
MooxiePlot2.DefineColor("Negative and Up", Color.DARK_ORANGE);
MooxiePlot2.AssignValueColor(if s2B>= 0 then if s2B > s2B[1] then MooxiePlot2.color("Positive and Up") else MooxiePlot2.color("Positive and Down") else if s2B < s2B[1] then MooxiePlot2.color("Negative and Down") else MooxiePlot2.color("Negative and Up"));
### THIRD TIME FRAME###
input aggPeriod3 = AggregationPeriod.WEEK;
script Mooxie3 {
    input priceC3 = close;
    def vc1C = ExpAverage(priceC3 , 12) - ExpAverage(priceC3 , 26);
    def va1C = ExpAverage(vc1C, 9);
    plot sData3 = (vc1C - va1C) * 3;}
def priceMooxie3 = close(period = aggPeriod3);
def s2C = Mooxie(priceMooxie3);
rec mooxieFTC = CompoundValue(1, 0.5 * (Log((1 + s2C) / (1 - s2c)) + mooxieFTC[1]), 0);
plot MooxiePlot3 = s2C; # Plot InverseFT Mooxie
MooxiePlot3.SetPaintingStrategy(PaintingStrategy.LINE);
MooxiePlot3.SetLineWeight(1);
MooxiePlot3.DefineColor("Positive and Up", Color.MAGENTA);
MooxiePlot3.DefineColor("Positive and Down", Color.MAGENTA);
MooxiePlot3.DefineColor("Negative and Down", Color.MAGENTA);
MooxiePlot3.DefineColor("Negative and Up", Color.MAGENTA);
MooxiePlot3.AssignValueColor(if s2c>= 0 then if s2c > s2c[1] then MooxiePlot3.color("Positive and Up") else MooxiePlot3.color("Positive and Down") else if s2c < s2c[1] then MooxiePlot3.color("Negative and Down") else MooxiePlot3.color("Negative and Up"));
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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