# [RS]GB

325 visitas
325
EXPERIMENTAL: test study on trend flow dinamics.
```//  ||-----------------------------------------------------------------------------------------------------||
study("[RS]GB", overlay=true)
//  ||-----------------------------------------------------------------------------------------------------||
//  ||---   Step 1 : Section Size.  -----------------------------------------------------------------------||
sectionsize = (syminfo.mintick*10) * input(100)
sectionfraction = sectionsize * 0.01
//  ||-----------------------------------------------------------------------------------------------------||
//  ||---   Step 2 : Trend  -------------------------------------------------------------------------------||
trend = ema(ema(ohlc4, input(120)), input(24))
rangedetection = input(24)
trenddirection = rising(trend, rangedetection) and rising(trend, 1) ? 1 :
falling(trend, rangedetection) and falling(trend, 1) ? -1 : 0
//  ||---    1 = UP TREND
//  ||---   -1 = DOWN TREND
//  ||---    0 = RANGE ::: need better way to define it!!
//  ||---
testc = trenddirection == 1 ? green : trenddirection == -1 ? maroon : gray
plot(trend, color=testc, linewidth=3)
plot(trend+sectionsize, color=green)
plot(trend+sectionsize*2, color=green)
plot(trend+sectionsize*3, color=green)
plot(trend+sectionsize*4, color=green)
plot(trend+sectionsize*5, color=green)
plot(trend-sectionsize, color=maroon)
plot(trend-sectionsize*2, color=maroon)
plot(trend-sectionsize*3, color=maroon)
plot(trend-sectionsize*4, color=maroon)
plot(trend-sectionsize*5, color=maroon)
//  ||---
//  ||-----------------------------------------------------------------------------------------------------||
//  ||---   Step 3 : Average Trend Angle  -----------------------------------------------------------------||
countertrend = trend - change(trend, input(120))
plot(countertrend, color=black, linewidth=3)
plot(countertrend+sectionsize, color=lime)
plot(countertrend+sectionsize*2, color=lime)
plot(countertrend+sectionsize*3, color=lime)
plot(countertrend+sectionsize*4, color=lime)
plot(countertrend+sectionsize*5, color=lime)
plot(countertrend-sectionsize, color=red)
plot(countertrend-sectionsize*2, color=red)
plot(countertrend-sectionsize*3, color=red)
plot(countertrend-sectionsize*4, color=red)
plot(countertrend-sectionsize*5, color=red)
//  ||-----------------------------------------------------------------------------------------------------||
//  ||-----------------------------------------------------------------------------------------------------||
//  ||-----------------------------------------------------------------------------------------------------||
```
How does it work? Can you explain what is based on? It is very interesting.

Thanks
Responder