Join useThinkScript to post your question to a community of 21,000+ developers and traders.
# START
def length = 8;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
HAclose = (HAopen + HAclose[1] + HAlow + close) / 4;
AssignPriceColor(if HAclose > HAopen then Color.GREEN else color.RED);
plot HAMA = Average(HAclose, length);
# END
#HK
#Use bar to figure trendDown or confirm.
#heikin ashi bars. close=OHLC/4. open=1/2(open[1]+close[1]) and HA trend
#
def haclose = (open + high + low + close) / 4;
def haopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close[1]) / 2);
def hahigh=max(open,max(close,high));def halow=min(open,min(close,high));
def HAtrendUP = haclose > haclose[1];
def upBar = if HAtrendUP then upBar[1] + 1 else 0;
def HATrendDown = haclose <= haclose[1];
def downBar = if HATrendDown then downBar[1] + 1 else 0;
def bars = upBar + downBar;
#the one with body small relative to wicks . let say less than 0.3
def HAtransition=absvalue((haopen-haclose)/(hahigh-halow))<0.3;
def HARed = HAOpen > HAclose;
def HAGreen = !HARed;
def HADecidedRed = HARed and HAHigh == HAopen;
def HADecidedGreen = HAGreen and HAlow == HAOpen;
plot data=0;
#
AssignPriceColor( if hatransition then color.MAGENTA
else Color.CURRENT);
def length = 8;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
HAclose = (HAopen + HAclose[1] + HAlow + close) / 4;
AssignPriceColor(if HAclose > HAopen then Color.GREEN else color.RED);
plot HAMA = Average(HAclose, length);
# Mobius
# SuperTrend HeikenAshi
# V03.10.2015
# Up = (HIGH + LOW) / 2 + Multiplier * ATR
# Down = (HIGH + LOW) / 2 – Multiplier * ATR
# When the change of trend occurs, the indicator flips
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;
input PaintBars = yes;
input BubbleOn = no;
input ShowLabel = no;
input AlertOn = no;
input PlotLine = no;
def HAopen;
def HAhigh;
def HAlow;
def HAclose;
HAopen = CompoundValue(1, (haopen[1] + haclose[1]) / 2, (open[1] + close) / 2);
HAhigh = Max(high, close[1]);
HAlow = Min(low, close[1]);
haclose = (HAopen + HAclose[1] + HAlow + close) / 4;
def v = volume;
def bar = barNumber();
def EOD = if SecondsTillTime(1545) == 0 and
SecondsFromTime(1545) == 0
then 1
else 0;
def NotActive = if SecondsFromTime(1545) > 0
then 1
else 0;
def ATR = MovingAverage(AvgType, TrueRange(HAhigh, HAclose, HAlow), nATR);
def UP = HL2 + (AtrMult * ATR);
def DN = HL2 + (-AtrMult * ATR);
def ST = if close < ST[1]
then Round(UP / tickSize(), 0) * tickSize()
else Round(DN / tickSize(), 0) * tickSize();
plot SuperTrend = ST;
SuperTrend.SetHiding(!PlotLine);
SuperTrend.AssignValueColor(if close < ST then Color.RED else Color.GREEN);
SuperTrend.SetPaintingStrategy(PaintingStrategy.Line);
AssignPriceColor(if PaintBars and close < ST
then Color.RED
else if PaintBars and close > ST
then Color.GREEN
else Color.CURRENT);
plot ST_point = if isNaN(close[-1])
then ST
else double.nan;
ST_point.SetStyle(Curve.Points);
ST_point.SetLineWeight(3);
ST_point.SetDefaultColor(Color.Yellow);
# End Code SuperTrend HeikenAshi
# Price Trend
# Drew Griffith
#hint: Color candlesticks based on price movement. New highs are green; New lows are red; Sideways trading are grey.
declare upper;
input trail = 1;
input displace = 1;
input aggregationperiod = aggregationperiod.day;
def new_high = close > highest(high(period = aggregationperiod), trail)[displace];
def new_low = close < lowest(low(period = aggregationperiod), trail)[displace];
def greenprice = if new_high then yes else if new_low then no else new_high[1];
def redprice = if new_low then yes else if new_high then no else new_low[1];
plot bullish = greenprice;
plot neutral = !greenprice and !redprice;
plot bearish = redprice;
plot rating =
if greenprice then 1
else if redprice then .5
else 0;
def paintbars = yes;
bullish.setdefaultcolor(color.uptick);
bullish.setpaintingstrategy(paintingstrategy.boolean_points);
bullish.setlineweight(3);
bullish.hide();
neutral.setdefaultcolor(color.gray);
neutral.setpaintingstrategy(paintingstrategy.boolean_points);
neutral.setlineweight(3);
neutral.hide();
bearish.setdefaultcolor(color.downtick);
bearish.setpaintingstrategy(paintingstrategy.boolean_points);
bearish.setlineweight(3);
bearish.hide();
rating.hide();
rating.hidebubble();
defineglobalcolor("bullish", color.uptick);
defineglobalcolor("neutral", color.gray);
defineglobalcolor("bearish", color.downtick);
assignpricecolor(if !paintbars then color.current else if greenprice then globalcolor("bullish") else if redprice then globalcolor("bearish") else globalcolor("neutral"));
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
C | RSI-Heiken Ashi For ThinkOrSwim | Indicators | 24 | |
MA Colored Heiken Ashi Trend with PaintBars for ThinkorSwim | Indicators | 15 | ||
C | Smoothed Heikin-Ashi for ThinkorSwim | Indicators | 54 | |
Stacked Moving Averages For ThinkOrSwim | Indicators | 77 | ||
All The Moving Average Ribbons for ThinkorSwim | Indicators | 12 |
Start a new thread and receive assistance from our community.
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.
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.