```
#START OF Moxie Salty Port for ThinkOrSwim
#
#CHANGELOG
# 2020.10.26 V1.1 @cos251 - Changed Colors; added transition signals (could be interpreted as buy/sell);
# - added input for aggperiod to allow use to customize or overlay more than one instance of indicator
# - for MTF style
# 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;
input showCloud = no;
input aggPeriod = AggregationPeriod.Min;
# Calculate MOXIE Salty Signal
# Moxie Salty Version Script
script Moxie {
input priceC = close;
def vc1 = ExpAverage(priceC , 12) - ExpAverage(priceC , 26);
def va1 = ExpAverage(vc1, 9);
plot sData = (vc1 - va1) * 3;
}
def priceMoxie = close(period = aggPeriod);
def s2 = Moxie(priceMoxie);
rec moxieFT = CompoundValue(1, 0.5 * (Log((1 + s2) / (1 - s2)) + moxieFT[1]), 0);
plot MoxiePlot = s2; # Plot InverseFT Moxie
MoxiePlot.SetPaintingStrategy(PaintingStrategy.LINE);
MoxiePlot.DefineColor("Positive and Up", Color.MAGENTA);
MoxiePlot.DefineColor("Positive and Down", Color.PLUM);
MoxiePlot.DefineColor("Negative and Down", Color.DARK_ORANGE);
MoxiePlot.DefineColor("Negative and Up", Color.YELLOW);
MoxiePlot.AssignValueColor(if s2 >= 0 then if s2 > s2[1] then MoxiePlot.color("Positive and Up") else MoxiePlot.color("Positive and Down") else if s2 < s2[1] then MoxiePlot.color("Negative and Down") else MoxiePlot.color("Negative and Up"));
# plot zero line
plot zero = 0;
# Plot Up and Down Signals
plot moxieUpArrow = if (Sign (s2 - s2[1]) > Sign (s2[1] - s2[2])) then s2[1] else Double.NaN;
plot moxieDownArrow = if (Sign (s2 - s2[1]) < Sign (s2[1] - s2[2])) then s2[1] else Double.NaN;
moxieUpArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
moxieUpArrow.SetDefaultColor(Color.GREEN);
moxieUpArrow.SetLineWeight(1);
moxieDownArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
moxieDownArrow.SetDefaultColor(Color.RED);
moxieDownArrow.SetLineWeight(1);
AddCloud(zero, MoxiePlot, Color.CYAN,Color.YELLOW);
```