Вы находитесь на странице: 1из 2

//@version=2

study(title="Moving Average Convergence/Divergence Histogram/Area",


shorttitle="MACD Histo")
source = close
fastLength = input(17, minval=1), slowLength=input(18,minval=1)
signalLength=input(50,minval=1)
fastMA = ema(source, fastLength)
slowMA = ema(source, slowLength)
macd = fastMA - slowMA
signal = ema(macd, signalLength)
histo = macd - signal

plotColor = if histo > 0


histo > histo[1] ? lime : green
else
histo < histo[1] ? maroon : red

plot(histo, color=plotColor, style=area)

#####################

//@version=3
strategy(title="Moving Average Convergence/Divergence Histogram/Area",
shorttitle="TEMA Strat", overlay=true)
intv = 7
tema = (3 * ema(close, intv)) - (3 * ema(ema(close, intv), intv)) +
(ema(ema(ema(close, intv), intv), intv))
tema2 = tema[1]
tema3 = tema[2]
tema4 = tema[3]
slope = (tema2-tema3)/(tema3-tema4)
plot(tema)
//plot(tema2)
buy() => crossover(close[1], tema2) and crossunder(close[2], tema3) and (close[1] >
open[1])
sell() => crossunder(close[1], tema2) and crossover(close[2], tema3) and (close[1]
< open[1])
//stop_level = strategy.position_avg_price * 0.998
//buy = close[1] > tema2 and close[2] < tema3
//sell = close[1] < tema2 and close[2] > tema3 and slope <= 1
strategy.entry(id = "long_tema", long = true, when = buy())
strategy.close(id = "long_tema", when = sell())
//strategy.order("Stop Loss", false, stop=stop_level, oca_name='L',
oca_type=strategy.oca.cancel, when=buy() and strategy.position_size > 0)
//plot(stop_level, color=red, style=linebr, linewidth=2)
//plotshape(buy, color=lime, style=shape.arrowup, text="Buy",
location=location.belowbar)
//plotshape(sell, color=red, style=shape.arrowdown, text="Sell",
location=location.abovebar)

#########################
// Simple, non-intrusive price action indicator by Zeenobit
// Based on "CM_Price-Action-Bars-Price Patterns That Work!" indicator by
ChrisMoody (Chris Capre from 2nd Skies Forex)
// The main difference is that this script uses shapes instead of bar colors.

//@version=3
study("Price Action", overlay=true)

pinBarTolerance = input(66, minval=1, maxval= 99, title="Pin Bar Tolerance


(%)")
pinBarLength = input( 6, minval=1, maxval=100, title="Pin Bar Historical
Trend Periods")
shavedBarTolerance = input( 5, minval=1, maxval= 99, title="Shaved Bar Tolerance
(%)")
enablePinBars = input(true, title="Enable Pin Bars")
enableShavedBars = input(true, title="Enable Shaved Bars")

cp = pinBarTolerance * 0.01
cpo = 1 - cp
cs = shavedBarTolerance * 0.01

range = high - low

isPinBarUp() => enablePinBars and open > high - (range * cpo) and close >
high - (range * cpo) and low <= lowest (pinBarLength)
isPinBarDown() => enablePinBars and open < high - (range * cp ) and close <
high - (range * cp ) and high >= highest(pinBarLength)
isShavedBarUp() => enableShavedBars and close >= (high - (range * cs))
isShavedBarDown() => enableShavedBars and close <= (low + (range * cs))

plotshape(isPinBarUp(), style=shape.triangleup, color=lime,


location=location.belowbar, title="Bullish Pin Bar")
plotshape(isPinBarDown(), style=shape.triangledown, color=red,
location=location.abovebar, title="Bearish Pin Bar")

plotshape(isShavedBarUp(), style=shape.square, color=green,


location=location.abovebar, title="Bullish Pressure")
plotshape(isShavedBarDown(), style=shape.square, color=maroon,
location=location.belowbar, title="Bearish Pressure")