Untitled
unknown
plain_text
5 months ago
3.0 kB
5
Indexable
//@version=4 study(title="Indicator [Profit Machine + Buy Sell]", shorttitle="PM_BuySell", overlay=true) // PMI_LA Indicator Parameters sm = input(6, title="PMI_LA Smoothing Period") cd = input(0.4, title="PMI_LA Constant D") ebc = input(false, title="PMI_LA Color Bars") ribm = input(false, title="PMI_LA Ribbon Mode") // Buy Sell Indicator Parameters a = input(2, title="BSI Multiplier") c = input(30, title="BSI ATR Period") h = input(false, title="BSI Heikin Ashi Candles") // PMI_LA Calculation var float i1 = na var float i2 = na var float i3 = na var float i4 = na var float i5 = na var float i6 = na var float bfr = na var color bfrC = na var float di = na var float c1 = na var float c2 = na var float c3 = na var float c4 = na var float c5 = na src_pmi = close di := (sm - 1.0) / 2.0 + 1.0 c1 := 2 / (di + 1.0) c2 := 1 - c1 c3 := 3.0 * (cd * cd + cd * cd * cd) c4 := -3.0 * (2.0 * cd * cd + cd + cd * cd * cd) c5 := 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd i1 := c1 * src_pmi + c2 * nz(i1[1]) i2 := c1 * i1 + c2 * nz(i2[1]) i3 := c1 * i2 + c2 * nz(i3[1]) i4 := c1 * i3 + c2 * nz(i4[1]) i5 := c1 * i4 + c2 * nz(i5[1]) i6 := c1 * i5 + c2 * nz(i6[1]) bfr := -cd * cd * cd * i6 + c3 * i5 + c4 * i4 + c5 * i3 bfrC := bfr > nz(bfr[1]) ? color.green : bfr < nz(bfr[1]) ? color.red : color.blue // Buy Sell Indicator Calculation xATR = atr(c) nLoss = a * xATR src_bsi = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=false) : close var float xATRTrailingStop = na xATRTrailingStop := iff(src_bsi > nz(xATRTrailingStop[1], 0) and src_bsi[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src_bsi - nLoss), iff(src_bsi < nz(xATRTrailingStop[1], 0) and src_bsi[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src_bsi + nLoss), iff(src_bsi > nz(xATRTrailingStop[1], 0), src_bsi - nLoss, src_bsi + nLoss))) var int pos = na pos := src_bsi[1] < nz(xATRTrailingStop[1], 0) and src_bsi > nz(xATRTrailingStop[1], 0) ? 1 : src_bsi[1] > nz(xATRTrailingStop[1], 0) and src_bsi < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0) xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue ema = ema(src_bsi, 1) above = crossover(ema, xATRTrailingStop) below = crossover(xATRTrailingStop, ema) buy = src_bsi > xATRTrailingStop and above sell = src_bsi < xATRTrailingStop and below // Plotting plot(ribm ? na : bfr, title="PMI_LA Trend", linewidth=3, color=bfrC) bgcolor(ribm ? bfrC : na, transp=50) plotshape(buy, title="Buy", text="Buy", style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, transp=0, size=size.tiny) plotshape(sell, title="Sell", text="Sell", style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, transp=0, size=size.tiny) barcolor(buy ? color.green : sell ? color.red : na) alertcondition(buy, "UT Long", "UT Long") alertcondition(sell, "UT Short", "UT Short")
Editor is loading...
Leave a Comment