# OverBought - OverSold explorer indicator "newbie" question

#### xel

##### Member
Hi, For an exploration indicator for an oscillator, let's talk about RSI, I want to do something like this:

Code:
``````RSIOb   =   70
RSIOs   =   30

[COLOR="Red"]RSIUt		=	RSI(14)		>	Ref(RSI(14),-1);
RSIDt		=	RSI(14)		< 	Ref(RSI(14),-1);
RSIBuy		=	RSI		<	RSIOs AND ARSIUt;
RSISell		=	RSI		>	RSIOb AND ARSIDt;[/COLOR]

WriteIf(RSI(14) > RSIOs,"OverSold",
WriteIf(RSIUt,"Improving",
WriteIf(RSIDt,"Declining",
WriteIf(RSI < RSIOb,"OverBought",
WriteIf(RSISell,"-=SELL=-",""))))));
IIf(RSI>ARSIOs,Color_bull,
IIf(RSIUt,Color_bull1,
IIf(RSIDt,Color_bear1,
IIf(RSI<ARSIOb,Color_bear,
IIf(RSISell,Color_sell,Color_null))))));

Filter = 1;

The result I want to obtain on the explorer indicator is the following:
1) BUY: When the RSI(14) are below the RSIOs level AND the trend of the indicator are upwards regarding it's last position.

2) Sell: When the RSI(14) are above the RSIOb level AND the trend of the indicator are downwards regarding it's last postion.

3) Trend: When the indicator is between the OverBought and OverSold levels, only reads the trend lecture regarding it's last position.

... What is wrong with the logic I am applying as marded on the Red Code ? I am missing something ?

#### KelvinHand

##### Well-Known Member
Hi, For an exploration indicator for an oscillator, let's talk about RSI, I want to do something like this:

The result I want to obtain on the explorer indicator is the following:
1) BUY: When the RSI(14) are below the RSIOs level AND the trend of the indicator are upwards regarding it's last position.

2) Sell: When the RSI(14) are above the RSIOb level AND the trend of the indicator are downwards regarding it's last postion.

3) Trend: When the indicator is between the OverBought and OverSold levels, only reads the trend lecture regarding it's last position.

... What is wrong with the logic I am applying as marded on the Red Code ? I am missing something ?
Give so much typo errors and not including the colors in the code. How you expect people to help you ?

1. RSIBuy : RSI(14) < RSIOs AND RSIUt;
Buy when RSI below 30 and the current RSI is slope up but still did not break above 30

2. RSISell : RSI(14) > RSIOb AND RSIDt;
Sell when RSI above 70 and the current RSI is slope down but still did break below 70

3. WriteIf(RSI(14) > RSIOs,"OverSold",
RSI > 30, how can be oversold ?

4. WriteIf(RSI(14) < RSIOb,"OverBought",
RSI < 70, how can be OverBought ?

5. If above logic is wrong. you are not able to do trend between 30 to 70

The following scripts rectified the errors but not rectified the logic.
Code:
``````Color_buy = colorGreen;
Color_bull = colorLime;
Color_bull1 = colorAqua;
Color_null = colorGrey40;
Color_bear = colorRed;
Color_bear1 = colorPink;
Color_sell = colorGold;

RSIOb   =   70;
RSIOs   =   30;

RSIUt		=	RSI(14)		>	Ref(RSI(14),-1);
RSIDt		=	RSI(14)		< 	Ref(RSI(14),-1);
RSIBuy		=	RSI(14)		<	RSIOs AND RSIUt;
RSISell		=	RSI(14)		>	RSIOb AND RSIDt;

WriteIf(RSI(14) > RSIOs,"OverSold",
WriteIf(RSIUt,"Improving",
WriteIf(RSIDt,"Declining",
WriteIf(RSI(14) < RSIOb,"OverBought",
WriteIf(RSISell,"-=SELL=-",""))))));