Moxie Indicator for ThinkorSwim

D

diazlaz

Well-known member
2019 Donor
VIP
I have watched many of the indicator videos from Simpler Options. Raghee Horner's approach using her 34 EMA waves with prop dots as well as Darvas really resonated with me. Watched her video a while ago. thought it made a lot of sense
@tomsk can you summarize the approach? Thanks
 
T

tomsk

Well-known member
VIP
Basically a trend approach. If there is no trend or sideways, no trade is taken. If I recall correctly it comprises 3-4 different indicators. She mentioned she had been using it for 33 years and her account has never blown up, and survived hedge fund blowups, crashes, etc.
 
flyingfalcon

flyingfalcon

New member
@flyingfalcon Moxie indicator is same as MACD but on a higher time frame. For daily, it is MACD on weekly time frame. Hahn-tech as it available here - https://www.hahn-tech.com/thinkorswim-mtf-macd-indicator/

I found this in 2018, but did not think it was very useful. After checking out recent promo videos on Moxie trader, it seems like a useful tool.
the default setting on hahn-tech has current time frame MACD enabled. make sure to disable 'Value', 'Avg' and 'Diff' by unchecking 'Show plot'. And enable 'midTermDiff' plot.

Hope this helps
 
flyingfalcon

flyingfalcon

New member
Once you install the indicator as explained on the hahn-tech link above, you need to make sure that mid-term > selected timefrade. the label will tell you if the time frame is correct. for example, for current time frame = daily, select mid term = "Weekly"; for hourly period, select mid-term='Daily" and for 15 min, select mid-term="60 min"
 
M

madpuri

Member
I did some digging on the moxie and found a person on trading view that has successfully mimicked the moxie indicator. It does line up with the videos of the real thing. Some of you here are amazing coders and may be able to convert this to thinkscript. I am still trying to decipher what is going on in the code beyond the first few lines...lol

https://www.tradingview.com/script/mssQsys9-Moxie-Arrows-Salty/

Here is the actual code for convience

Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © markmiotke
//@version=4
// Moxie_Arrows[Salty]
// By Mark Miotke
// Initial Release: 2/20/2020


study(title="Moxie_Arrows[Salty]", overlay=false)
ShowZeroCrossArrows = input(false, title="Show Zero Cross Arrows")
ShowCrossArrows = input(false, title="Show Cross Arrows")

Red       = #FF0000
DarkRed   = #BA0000
Green     = #00FF00
DarkGreen = #00BA00

funcMoxie() =>
    priceC = close
    vc1 = ema(priceC , 12) - ema(priceC , 26)
    va1 = ema(vc1, 9)
    (vc1 - va1) * 3

//Resolution, e.g. '60' - 60 minutes, 'D' - daily, 'W' - weekly, 'M' - monthly, '5D' - 5 days, '12M' - one year, '3M' - one quarter
currentPeriod = timeframe.period

s2 = currentPeriod == '1' or currentPeriod == '3' ? security(syminfo.tickerid, '5', funcMoxie())
  : currentPeriod == '5' ? security(syminfo.tickerid, '15', funcMoxie())
  : currentPeriod == '15' ? security(syminfo.tickerid, '30', funcMoxie())
  : currentPeriod == '30' ? security(syminfo.tickerid, '60', funcMoxie())
  : currentPeriod == '45' ? security(syminfo.tickerid, '120', funcMoxie())
  : currentPeriod == '60' or currentPeriod == '120' or currentPeriod == '180' or currentPeriod == '240' ? security(syminfo.tickerid, 'D', funcMoxie())
  : currentPeriod == 'D' ? security(syminfo.tickerid, 'W', funcMoxie())
  : currentPeriod == 'W' ? security(syminfo.tickerid, 'M', funcMoxie())
  : na

c_color=s2 < 0 ? (s2 < s2[1] ? DarkRed : DarkGreen) : (s2 >= 0 ? (s2 > s2[1] ? Green : Red) : na)
fill_Color=s2 < 0 ? (s2 < s2[1] ? DarkRed : Red) : (s2 >= 0 ? (s2 > s2[1] ? Green : DarkGreen) : na)

p1 = plot(s2 , style=plot.style_line, color=c_color, linewidth=3, transp=0)
zeroline = hline(0, title="Zero Line", color=color.black, linestyle=hline.style_dotted, linewidth=1)
plotshape(ShowZeroCrossArrows and crossover(s2, 0) ? s2 : na, color=Green, style=shape.arrowup, location=location.absolute, size=size.huge)
plotshape(ShowCrossArrows and crossover(s2, s2[1]) and s2 > 0 ? s2 : na, color=Green, style=shape.arrowup, location=location.absolute, size=size.huge)
plotshape(ShowCrossArrows and crossunder(s2, s2[1]) and s2 > 0 ? s2 : na, color=Red, style=shape.arrowdown, location=location.absolute, size=size.normal)
plotshape(ShowZeroCrossArrows and crossunder(s2, 0) ? s2 : na, color=DarkRed, style=shape.arrowdown, location=location.absolute, size=size.huge)
plotshape(ShowCrossArrows and crossunder(s2, s2[1]) and s2 < 0 ? s2 : na, color=DarkRed, style=shape.arrowdown, location=location.absolute, size=size.huge)
plotshape(ShowCrossArrows and crossover(s2, s2[1]) and s2 < 0 ? s2 : na, color=DarkGreen, style=shape.arrowup, location=location.absolute, size=size.normal)
fill(p1,plot(0,color=color.black,linewidth=1),color=fill_Color,transp=50)

cheers
 
Last edited by a moderator:
D

diazlaz

Well-known member
2019 Donor
VIP
here you go @madpuri .



Ruby:
#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.DARK_GREEN);
pMoxie.DefineColor("Negative and Down", Color.RED);
pMoxie.DefineColor("Negative and Up", Color.DARK_RED);
pMoxie.AssignValueColor(if pMoxie >= 0 then if pMoxie > pMoxie[1] then pMoxie.color("Positive and Up") else pMoxie.color("Positive and Down") else if pMoxie < pMoxie[1] then pMoxie.color("Negative and Down") else pMoxie.color("Negative and Up"));

AddCloud(ZeroLine,pMoxie,COLOR.RED,COLOR.GREEN);

#END OF Moxie Salty Port for ThinkOrSwim
 
M

madpuri

Member
here you go @madpuri .



Ruby:
#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.DARK_GREEN);
pMoxie.DefineColor("Negative and Down", Color.RED);
pMoxie.DefineColor("Negative and Up", Color.DARK_RED);
pMoxie.AssignValueColor(if pMoxie >= 0 then if pMoxie > pMoxie[1] then pMoxie.color("Positive and Up") else pMoxie.color("Positive and Down") else if pMoxie < pMoxie[1] then pMoxie.color("Negative and Down") else pMoxie.color("Negative and Up"));

AddCloud(ZeroLine,pMoxie,COLOR.RED,COLOR.GREEN);

#END OF Moxie Salty Port for ThinkOrSwim

I think a hot damn is in order!!!!!
 
M

madpuri

Member
@diazlaz so I am trying to match the slope line colors of the moxie code. I got close but the red color for the downslope is not showing up.
Appreciate any insight you can provide. I removed the cloud code since it is not needed.

I am unable to post images for some reason, but this youtube link should give you a clue as to what I am trying to do with the sloping lines of the moxie

 
MerryDay

MerryDay

Active member
VIP
@madpuri For instructions on posting images, go to the tutorial here. On your image, draw exactly what you are looking for and what is not showing up.
 
M

madpuri

Member
Thanks. @MerryDay

@diazlaz take a look at this image below. I have circled what I am trying to achieve with the moxie. If slope of moxie is down, indicator should be red even if it is slight.



However, I keep getting the following when I tweak the code. What I have circled here should be green not read since the slope is positive not negative.

 
D

diazlaz

Well-known member
2019 Donor
VIP
Hi @madpuri,

not sure, I don't trade this system. it could be a different interpretation or a set of inputs that are different.

I went back and compared the trading view results and it's similar to that version of the Moxie.

TradingView:


TOS:
 
M

madpuri

Member
@diazlaz The indicator in the screen shot I posted is the same as trading view BUT I am just trying to match it color wise. I am just trying to change the color. Nothing more. That is what I was trying to highlight. When the line is above zero and slopes down. It should be red not green. That is all I am trying to change. Similarly if the line is below zero and sloping up. It should be green not red.
Hope this clarifies.
 
Last edited:
L

Leymart

New member
I have the original Moxie indicator for tos
 
Last edited:
rad14733

rad14733

Well-known member
VIP
@madpuri Simply swap Negative and Down and Positive and Up colors for the pMoxie plot... 💡
 
M

madpuri

Member
@madpuri Simply swap Negative and Down and Positive and Up colors for the pMoxie plot... 💡
I tried that but it did not produce the correct result. I will try again and post a picture. Perhaps i did it wrong initially
 
rad14733

rad14733

Well-known member
VIP
I tried that but it did not produce the correct result. I will try again and post a picture. Perhaps i did it wrong initially
It may not be exact but it does produce essentially the same effect... I only tested one stock symbol...
 
M

madpuri

Member
It may not be exact but it does produce essentially the same effect... I only tested one stock symbol...
plot ZeroLine = 0;
plot pMoxie = s2;
pMoxie.SetLineWeight(2);
pMoxie.DefineColor("Positive and Up", Color.GREEN);
pMoxie.DefineColor("Positive and Down", Color.DARK_RED); <-------
pMoxie.DefineColor("Negative and Down", Color.RED);
pMoxie.DefineColor("Negative and Up", Color.DARK_GREEN); <-------
pMoxie.AssignValueColor(if pMoxie >= 0 then if pMoxie > pMoxie[1] then pMoxie.color("Positive and Up") else pMoxie.color("Positive and Down") else if pMoxie < pMoxie[1] then pMoxie.color("Negative and Down") else pMoxie.color("Negative and Up"));

The arrows are where I made the changes. It messes up the indicator. Now slopes above zero line and sloping up are red. That should not be the case. I may check some indicators produced here. They are able to produce what I am looking for. I think the issue is the way the assignvaluecolor is written. (To be clear, the code is a perfect translation of tradingview, but I am trying to match the color change as previously shown)

Basically I am trying to get this to plot like @horserider's MACD.

 
Last edited:

Similar threads

Top