TradingView
robertmray1986
Sep 17, 2020 4:19 AM

Simple Trend Short

Ether Classic / United States DollarCoinbase

Description

//Indicator for trend identification (based on position of moving averages)
//Editor - balance.
//21/05/2017


count1 = 0
count2=0
upcount=0
downcount=0

lma = Average[longma](close)
sma = Average[shortma](close)

increase = sma>lma
decrease=lma>sma

while (increase[count1]) do
upcount =upcount +1
count1=count1+1
wend

while (decrease[count2]) do
count2 = count2+1
downcount=downcount-1
wend

UPtrend = upcount > unitsforthetrend
DOWNtrend= downcount < -unitsforthetrend

v=0

if (uptrend)then
v=1
elsif (downtrend)then
v=-1
else
v=0
endif

a=0

return v coloured(0,0,0)as "trend line",a coloured(255,0,0)as "zero line"
More