Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

study(title="A1 Trend Indicator", shorttitle="A1 trend", overlay=true)

MAlength = input(35, title="Length of Moving Averages")

petd = ema(close, MAlength)


petx = wma(close, MAlength)
pety = sma(close, MAlength)

iGreen=(close > petd) and (close > petx) and (close > pety)
iBlue = ((close > petd) or (close > petx) or (close > pety)) and not ((close >
petd) and (close > petx) and (close > pety)) and not ((close < petd) and (close <
petx) and (close < pety))
iRed = (close < petd) and (close < petx) and (close < pety)

up = (close > petd) and (close > petx) and (close > pety) ? green : (close > petd)
or (close > petx) or (close > pety) ? blue : red
test = (petd + petx + pety) /3
//plot(out2 and smaplot ? out2 :na , title="SMA", color=mycolor2, linewidth=1)
plot(test, title="Buy Sell", color= white )

barcolor(up)

alertcondition(iRed,"Going Red","Going Red")


alertcondition(iGreen,"Going Green ","Going Green" )
alertcondition(iBlue,"Going Blue","Going Blue")

conditioncrossover=crossover(test, close)
conditioncrossunder=crossunder(test, close)
alertcondition(conditioncrossover,"Crossing Up","Crossing Up")
alertcondition(conditioncrossunder,"Crossing Down","Crossing Down")

plot(petd, color= blue , title="Blue Plot")


plot(petx, color= yellow , title="Yellow Plot")
plot(pety, color= red , title="Red Plot")

petyMulti = pety + test- ((pety + test /100) * 12)


petyMulti2 = (open + close) / 2 // pety + test
//Decrease = Original Number - New Number
//% Decrease = Decrease ÷ Original Number × 100

//Increase = New Number - Original Number


//% increase = Increase ÷ Original Number × 100.

buy = (petx > petd) and (petd> pety)


sell = (pety > petd) and (petd> petx)
//v(petd> pety)

tbuy=test - pety
t2buy= (tbuy / test)*100

CurrentMA= sma(close, 50)


LastMA = CurrentMA[1]

Last5Avg= (CurrentMA[3]+CurrentMA[4]+CurrentMA[5]+CurrentMA[6]+CurrentMA[7]) /5
samIncrese=CurrentMA-LastMA
samPercIncrese=(samIncrese/CurrentMA )* 100

samDecrease=LastMA - CurrentMA
samPercDecrease=(samDecrease/LastMA )* 100

LastAvgDec= Last5Avg-CurrentMA
LastAvgPercDecrease=(LastAvgDec/Last5Avg )* 100

LastAvgInc= CurrentMA-Last5Avg
LastAvgPercIncrease=(CurrentMA/Last5Avg )* 100

//Simple Buysell
//plotshape(buy, title= "Buy", location=location.belowbar, color=lime,
style=shape.arrowup, text="")
//plotshape(sell, title= "Sell", location=location.abovebar, color=red,
style=shape.arrowdown, text="")

//SMA Buy Sell


///plotshape(samPercIncrese>.005 and true, title= "Buy",
location=location.belowbar, color=lime, style=shape.arrowup, text="")
//plotshape(samPercDecrease>.005 and true , title= "Sell",
location=location.abovebar, color=red, style=shape.arrowdown, text="")
//Ttest

plotshape(samPercIncrese>.006 and buy, title= "Buy Arrow",


location=location.belowbar, color=lime, style=shape.arrowup, text="")
plotshape(samPercDecrease>.006 and sell , title= "Sell Arrow",
location=location.abovebar, color=red, style=shape.arrowdown, text="")

//plotshape(t2 < .3, title= "Sell", location=location.abovebar, color=red,


style=shape.arrowdown, text="")

//plotshape(ReversalShort, title= "ReversalShort", location=location.abovebar,


color=red, style=shape.arrowdown, text="SELL")

//plot(petyMulti2, color= green , title="Gary Trader Strategy petyMulti")

timeinrange(res, sess) => time(res, sess) != 0

showTimes = input(false, title="Show Closing")

c= iff(showTimes, gray, black)


bgcolor(timeinrange(period, "1530-1900") ? c : na, transp=70)

You might also like