Moxie Slippage + Bon Bon Watchlist Indicator Help

abestinkin8

New member
Hello again --

I'm trying to take 2 studies and make them into 2 separate watchlist columns. One is Moxie Slippage, and the other is BonBon's Heikn_Ashi. This is developed from this thread: https://usethinkscript.com/threads/moxie-indicator-trend-trader-pro-strategies-combined.6187/. (on page 6 he posts the script for the upper section, which is what I am modifying.

Rather than having long arrows or short arrows, I'd like the watchlist column to light up Dark Green/Dark Red whenever the arrows would appear on the chart. Then they would be Gray for everything else.

Right now, it lights up green whenever the long arrows show up. This is good and the ideal function of what I want it to do. However, I would like the boxes to be gray the rest of the time (unless the short arrow/dark red box would show up). It just displays NaN everywhere. I know which part of the script needs to be modified (anywhere it is double.nan) I'm just not sure how to tighten this up a bit.

Here is my code so far:

input lookback = 5; # past N minutes
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 price =
if currentAggPeriod == AggregationPeriod.FIFTEEN_MIN then high(period = higherAggPeriod)
else close(period = higherAggPeriod)
;
def Moxie = MoxieFunc(price);

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


AssignBackgroundColor(if longtrigger then color.darK_GREEN
else if shorttrigger then color.dark_RED
else color.gray);
AssignPriceColor(if longtrigger then color.darK_GREEN
else if shorttrigger then color.darK_RED
else color.gray);

EDIT: One other thing I'd like to do is have it sort only whether it is dark green or dark red, rather than by the Moxie number. That way when a buy arrow shows up it would automatically move to the top of the watchlist.
 
The other half of this is @BonBon 's script, which was posted here: https://usethinkscript.com/threads/completed-heikin_ashi-indicator.5251/page-2

My slightly altered of theirs is as follows:

input period = 1;
input hideCandles = no;
input candleSmoothing = {default Valcu, Vervoort};
input show_bubble_labels = yes;

input movingAverageType = {default Exponential, TEMA};

def openMA;
def closeMA;
def highMA;
def lowMA;

switch (movingAverageType) {

case Exponential:
openMA = CompoundValue(1, ExpAverage(open, period), open);
closeMA = CompoundValue(1, ExpAverage(close, period), close);
highMA = CompoundValue(1, ExpAverage(high, period), high);
lowMA = CompoundValue(1, ExpAverage(low, period), low);

case TEMA:
openMA = CompoundValue(1, TEMA(open, period), open);
closeMA = CompoundValue(1, TEMA(close, period), close);
highMA = CompoundValue(1, TEMA(high, period), high);
lowMA = CompoundValue(1, TEMA(low, period), low);
}


def haOpen = CompoundValue(1,( (haOpen[1] + (openMA[1] + highMA[1] + lowMA[1] + closeMA[1]) / 4.0) / 2.0), open);
def haClose = ((((openMA + highMA + lowMA + closeMA) / 4.0) + haOpen + Max(highMA, haOpen) + Min(lowMA, haOpen)) / 4.0);
def haLow = Min(lowMA, Min(haclose, haOpen));
def haHigh = Max(highMA, Max(haclose, haOpen));

def trend = haclose >= haopen;
plot trendup = trend and !trend[1];

def trendd = haclose < haopen;
plot trendDown = trendd and !trendd[1];

def arrowup = trendup;
def arrowdown = trenddown;

def trigger = if arrowup then 100 else if arrowdown then -100 else trigger [1];

AddLabel(yes, if trigger == 100 then "👍" else if trigger == -100 then "👎" else "NA", if trigger ==100 then color.gRAY else if trigger == -100 then color.black else color.white);

AssignbackgroundColor(if trigger == 100 then Color.dark_GREEN else if trigger == -100 then Color.dark_Red else Color.grAY);

alert(Trendup,"Trend Up", alert.Bar, sound.bell);
alert(Trenddown,"Trend down", alert.Bar, sound.bell);


My issue is that the "thumbs up" and "thumbs down" don't seem to correspond to the green/red lights on the chart. Ideally, I'm assuming the thumbs up would trigger if all of the rows are green? I could be misunderstanding though.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
441 Online
Create Post

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