TradingView
OrcChieftain
27 de May. de 2020 6:56

Volatility Optimizer 

Euro Fx/U.S. DollarFXCM

Descripción

I created Volatility Optimizer to test various volatility conditions and how they affect signals/indicators I create for my customer. It pits long-term, short-term and middle-term ranges against each other. Whichever is highest will also print a dot on the top of the indicator window.

Most indicators and strategies work well in only one area. Whether you differentiate market phases to contraction/expansion/trend or sideways/impulse wave/correction, Optimus might help you filter out wrong signals. For example, in the impulse wave, the shortest period range (Blue) should get quickly on top. If you are seeking opportunities in the correction phase, it is when red should be dominant.

The lengths of ranges need to be set based on your strategy and timeframe. If you look many candles back, the preset values probably need to be increased.

You may look are which volatility length average is highest. You might also look at which one is ascending or descending.

Good luck!
Comentarios
SpaceCakes
Mate thank you for this, i have been looking for days trying to find something and attempted to code my own Market Condition identify. Based on your indicator you can clearly see the change in the market. When a new trend is about to begin, when pull backs are likely to start during a trend. Quite frankly with this you can switch strats to optimize your win ratio reduce risk by appropriately trading effectively dependent on the markets current cycle.

I am hoping that one day you release this script to open source, as this would really help with creating a multi Strat that dynamically switches.
In the mean time i will attempt to continue to create my own.
Congrats and Kudos and keep up the good work.
OrcChieftain
@SpaceCakes, Hey, it is really simple stuff, I think you are overestimating it a little. Is there a way to open a protected script or should I just send you the code or republish?
SpaceCakes
@greenmask9, Wow its up to you mate you can either republish or some post the code in the comments. I am a rookie coder learning pine 4 took some time then they updated lol.
From what i can tell your using 3 ATR levels then plotting them, Ideally i dont need to see it once its running only to adjust settings. Want it to act as a filter in a while loop that breaks depending on which condition is met. Then executes a strat based on the condition of the market. Basically trying make a dynamic strat for consolidated automation.
OrcChieftain
@SpaceCakes, //first
l1 = input(title="Lowest", defval=8, minval=1)
s1 = input(title="Smoothing", defval="EMA", options=["RMA", "SMA", "EMA", "WMA"])
atr1(source, l1) =>
if s1 == "EMA"
ema(source, l1)
else
if s1 == "SMA"
sma(source, l1)
if s1 == "RMA"
rma(source, l1)
else
wma(source, l1)

//second
l2 = input(title="Middle", defval=32, minval=1)
s2 = input(title="Smoothing", defval="SMA", options=["RMA", "SMA", "EMA", "WMA"])
atr2(source, l2) =>
if s2 == "SMA"
sma(source, l2)
else
if s1 == "RMA"
rma(source, l2)
else
if s2 == "EMA"
ema(source, l2)
else
wma(source, l2)

//third
l3 = input(title="Lowest", defval=115, minval=1)
s3 = input(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"])
atr3(source, l3) =>
if s1 == "RMA"
rma(source, l3)
else
if s1 == "SMA"
sma(source, l3)
else
if s1 == "EMA"
ema(source, l3)
else
wma(source, l3)

atr10=atr1(tr(true), l1)
atr20=atr2(tr(true), l2)
atr30=atr3(tr(true), l3)

plot(atr10, title = "ATR short", color=#0066ff, style=plot.style_area, transp=30)
plot(atr20, title = "ATR middle", color=#ff3300, style=plot.style_area, transp=30)
plot(atr30, title = "ATR long", color=#996600, style=plot.style_area, transp=30)

plot(atr10, title = "ATR short", color=#0066ff, transp=0, linewidth=2)
plot(atr20, title = "ATR middle", color=#ff3300, transp=0, linewidth=2)
plot(atr30, title = "ATR long", color=#996600, transp=0, linewidth=2)

shape1 = atr10>atr20 and atr10>atr30
shape2 = atr20>atr10 and atr20>atr30
shape3 = atr30>atr10 and atr30>atr20

plotshape(shape1, title = "ATR short", style=shape.circle, location=location.top, color=#0066ff, size=size.tiny)
plotshape(shape2, title = "ATR middle", style=shape.circle, location=location.top, color=#ff3300, size=size.tiny)
plotshape(shape3, title = "ATR long", style=shape.circle, location=location.top, color=#996600, size=size.tiny)
OrcChieftain
@SpaceCakes, You will need to space the if sequences properly. Version 4 is the best if you don't need new elements that are only in v5.
SpaceCakes
@greenmask9, This is awesome mate thank you so much, i have just found a really cool script by EvoCrypto as well who has separated the positive and the negative in an ATR basically you can see the increase in volatility in the buyers and sellers. Version 4 is good an i wont need i guess right now anything from version 5. Thanks again bro for this.
Más