Coding the Moxie indicator for Wave59, help appreciated...

Have a QScript to share, or need help with programming? Post your comment here.
Post Reply
julianw
Posts: 7
Joined: Tue Jul 21, 2015 9:13 pm
Contact:

Coding the Moxie indicator for Wave59, help appreciated...

Post by julianw » Sun Mar 07, 2021 9:44 pm

I'd really like to get the Moxie indicator working for Wave59, judging by online feedback. many of its users seem to have had great results using it.

The code reads fairly simply and is open source on thinkorswim, and the ubiquitous tradingview online charting platform

This script plots a form of momentum using data from higher time frames
The indicator seems to grab bars from the next highest timeframe, I'm using daily charts, so this would be weekly bars.

In thinkorswim the tricky line of code is:
"if currentAggPeriod <= AggregationPeriod.DAY then AggregationPeriod.WEEK"

Code is here:
https://usethinkscript.com/threads/moxi ... post-53789
and here:
https://www.tradingview.com/script/mssQ ... ows-Salty/

I'm trying to figure this out by pulling the weekly close from the previous fridays close, I was thinking along the lines of a counter that counts to five (to simulate Friday close on a five day trading week), then every time it counts to five it adds a value to an array that the 'moxiefunc' function makes use of.

This is as far as I got:

(Here is the 'moxiefunc' function the Moxie indicator references)

#returns moxiefunc

input: price;
vc1=xaverage(price, 12) - xaverage(price , 26);
va1=xaverage(vc1, 9);
plotdata = (vc1-va1)*3;
return plotdata;

(Moxie indicator)

input:lookback(5);
if (barnum==barsback)
{
longArrowPosition=low;
}
Moxie = MoxieFunc(close[lookback]);
if (Moxie > 0 and Moxie[1] <= 0)
{
longTrigger = Moxie;
}
else
{
longTrigger = false;
}
if (Moxie==longTrigger) and (Moxie != Moxie[1])
{
longArrowPosition=low;
}
else if (Moxie==longTrigger) and (Moxie==Moxie[1])
{
longArrowPosition=longArrowPosition[1];
}
plot1=longArrowPosition;

This is what my plot looks like:

Image

Here are some examples of what it should look like.

Image

Image

Any help figuring this out would be most appreciated :)
I'm sure there will be an easy way for Wave59 to do this. Anyway for the type of trading I do Wave59 leaves these other platforms in the dust, nothing else comes close. Just a different reality bubble...

User avatar
earik
Site Admin
Posts: 474
Joined: Mon Dec 01, 2014 12:41 pm
Contact:

Re: Coding the Moxie indicator for Wave59, help appreciated...

Post by earik » Wed Mar 10, 2021 6:06 pm

Hi Julian,

A feature that never quite made it into W59 was calling up data sets with different time compressions, etc. So you have to compute the longer time frame by using the bars you already have. However, this can actually be a very easy thing to do if the time frames fit into each other.

For example, let's say we're watching a 1min chart, and we want to pull a 10 period average from the 5 minute chart onto it. One way to do this is to load up the 5min chart somewhere, compute the average, then bring that calculation over to the 1min. Back when I worked at the CBOT, before W59 existed, I wanted to do this very thing using TradeStation and jumped through all sorts of hoops to make it work the way I needed. I did something very similar to what you are trying to do. And then some old timer told me to knock it off and just plot a 50 period average from the 1min. ;) When I plotted both on top of each other, I found they were the same, except the 50 period average had a higher resolution since it wasn't so chunky and could be calculated every single bar.

Obviously, this will work better with certain things than others, but if all this indicator does is Xav(Xav12 - Xav26,9) * 3, that seems like a pretty good candidate for you. Just multiply all the lengths by whatever the difference in the time frame is. So the weekly version of this plotted on a daily chart is really just xav(xav12*5 - xav26*5, 9*5) * 3. Same formula, just multiplied all the lengths by 5. Try that, and see what you think. Might be an easier way to do this than trying to mess around with trying to simulate larger time frames.

Earik

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests