#### YungTraderFromMontana

##### Well-known member

For clarity here are the conditions for each separate indicator in plot x (bullish). Plot q not shown here is opposite.

Condition 1 (Main > Signal)

Condition 2 (RSI > RSI_BearishTrigger) or ((RSI >= RSI[1]) and (RSI > RSI_BullishTrigger))

Condition 3 (trendup is true)

I'm posting the conditions I used along with this including the butchered code I was working with (that was not written by me, RSI Laguerre by Mobius and JQ as well as True Momentum Indicator written by Mobius) and also would like to let anyone who sees this know I'm trying to find a way to effectively use overbought/oversold zones provided by the indicators to enhance the strategy. I'll provide updates as I progress.

Here is a chart example as of now. For any confusion it signals an arrow before the close of a bar so all three may not align. If for example, they were all green at somepoint within the bar but then one closed red it still gives a green arrow. Beware that arrows were aligned poorly and screen may have to be adjusted to separate the candles from signal arrows.

https://tos.mx/6iGf9ms

Code:

```
declare lower;
input compBars = 6;
input paintBars = no;
input RSI_BullishTrigger = .2;
input RSI_BearishTrigger = .8;
input soundBullAlerts = no; ## 5.15.2018 new code
input soundBearAlerts = no; ## 5.15.2018 new code
input nFE = 13;#hint nFE: length for Fractal Energy calculation.
input length = 14;
input calcLength = 5;
input smoothLength = 3;
def o = open;
def c = close;
def data = fold i = 0 to length
with s
do s + (if c > GetValue(o, i)
then 1
else if c < GetValue(o, i)
then - 1
else 0);
def EMA5 = ExpAverage(data, calcLength);
def Main = ExpAverage(EMA5, smoothLength);
def Signal = ExpAverage(Main, smoothLength);
# Variables:
def oh;
def h;
def l;
def ch;
def CU1;
def CU2;
def CU;
def CD1;
def CD2;
def CD;
def L0;
def L1;
def L2;
def L3;
def RSI;
def OS;
def OB;
def TrendUp = Double.NaN;
def TrendDown = Double.NaN;
# Calculations
oh = (open + close[1]) / 2;
h = Max(high, close[1]);
l = Min(low, close[1]);
ch = (o + h + l + close) / 4;
plot gamma = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE) /
(Highest(high, nFE) - Lowest(low, nFE)))
/ Log(nFE);
gamma.SetDefaultColor(Color.YELLOW);
L0 = (1 – gamma) * c + gamma * L0[1];
L1 = -gamma * L0 + L0[1] + gamma * L1[1];
L2 = -gamma * L1 + L1[1] + gamma * L2[1];
L3 = -gamma * L2 + L2[1] + gamma * L3[1];
if L0 >= L1
then {
CU1 = L0 - L1;
CD1 = 0;
} else {
CD1 = L1 - L0;
CU1 = 0;
}
if L1 >= L2
then {
CU2 = CU1 + L1 - L2;
CD2 = CD1;
} else {
CD2 = CD1 + L2 - L1;
CU2 = CU1;
}
if L2 >= L3
then {
CU = CU2 + L2 - L3;
CD = CD2;
} else {
CU = CU2;
CD = CD2 + L3 - L2;
}
RSI = if CU + CD <> 0 then CU / (CU + CD) else 0;
OS = if IsNaN(close) then Double.NaN else 0.2;
OB = if IsNaN(close) then Double.NaN else 0.8;
def data1 = (RSI > RSI_BearishTrigger) or ((RSI >= RSI[1]) and (RSI > RSI_BullishTrigger));
def data2 = (RSI < RSI_BullishTrigger) or ((RSI < RSI[1]) and (RSI < RSI_BearishTrigger));
def data3 = trenddown is true;
def data4 = trendup is true;
plot x = (Main > Signal) and (RSI > RSI_BearishTrigger) or ((RSI >= RSI[1]) and (RSI > RSI_BullishTrigger)) and (trendup is true);
plot q = (Main < Signal) and (RSI < RSI_BullishTrigger) or ((RSI < RSI[1]) and (RSI < RSI_BearishTrigger)) and (trenddown is true);
```