Page 1 of 1

Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by LRP
Dear Community

Is this IBS-indicator already build in MC, maybe with another name?
http://qusma.com/2012/11/06/closing-pri ... reversion/

Can someone please code it as working indicator?
I am a little confused because i always get an Error (division/zero)

Thank you very much
LRP

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by TJ
Dear Community

Is this IBS-indicator already build in MC, maybe with another name?
http://qusma.com/2012/11/06/closing-pri ... reversion/

Can someone please code it as working indicator?
I am a little confused because i always get an Error (division/zero)

Thank you very much
LRP
If you have already tried, you should post your attempt and let the community help you to debug.

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by LRP
If you have already tried, you should post your attempt and let the community help you to debug.
Thank you TJ,
OK lets try, this is my attempt:

// Internal Bar Strength Indicator (IBS)
// Source: http://qusma.com/2012/11/06/closing-pri ... reversion/

vars: Oben(0), Unten(0), Durch(0);

Oben = (Close-low);
Unten = (High - Low);

Durch = (Oben/Unten);

Plot1( Oben, "0ben" );
Plot2 (Unten, "Unten");
Plot3 (Durch, "IBS")

THX for your inputs

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by TJ
If you have already tried, you should post your attempt and let the community help you to debug.
Thank you TJ,
OK lets try, this is my attempt:

// Internal Bar Strength Indicator (IBS)
// Source: http://qusma.com/2012/11/06/closing-pri ... reversion/

vars: Oben(0), Unten(0), Durch(0);

Oben = (Close-low);
Unten = (High - Low);

Durch = (Oben/Unten);

Plot1( Oben, "0ben" );
Plot2 (Unten, "Unten");
Plot3 (Durch, "IBS")

THX for your inputs
What would be the value of Unten if the high = low?

What would be the impact on Durch?



ps. [FAQ] How to Post Codes
viewtopic.php?f=16&t=11713

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by LRP
OK, i try again:
The problem is if the dominator result is a zero.
I am not sure if it is correct coded?

Code: Select all

// Internal Bar Strength Indicator (IBS)
// Source: http://qusma.com/2012/11/06/closing-price-in-relation-to-the-days-range-and-equity-index-mean-reversion/

vars: Above(0), Below(0), IBS(0);

Above = (Close-Low);
Below = (High-Low);

if Below <> 0 then

IBS = (Above/Below);

Plot1 (IBS, "InternalBarStrength")

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by TJ
OK, i try again:
The problem is if the dominator result is a zero.
...
You have to decide the next logic:

What to do when the dominator is zero?

1. Do you make IBS the same value as the previous bar? (ie skip the calculation)
2. Make IBS = zero?
3. some other logic?

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by TJ
OK, i try again:
The problem is if the dominator result is a zero.
I am not sure if it is correct coded?

Code: Select all

// Internal Bar Strength Indicator (IBS)
// Source: http://qusma.com/2012/11/06/closing-price-in-relation-to-the-days-range-and-equity-index-mean-reversion/

vars: Above(0), Below(0), IBS(0);

Above = (Close-Low);
Below = (High-Low);

if Below <> 0 then

IBS = (Above/Below);

Plot1 (IBS, "InternalBarStrength")
I see that you have edited your post...

Yes, that is a good check for "Division by Zero".

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by LRP
OK, i try again:
The problem is if the dominator result is a zero.
...
You have to decide the next logic:

What to do when the dominator is zero?

1. Do you make IBS the same value as the previous bar? (ie skip the calculation)
2. Make IBS = zero?
3. some other logic?
Thank TJ for your patience
sorry I edited my code and did not see your fast reply
Do you think it is now correct?

Re: Internal Bar Strength (IBS)

Posted: 04 Jun 2013
by TJ
This will skip a bar's calculation and repeat the previous bar's value

Code: Select all

if Below <> 0 then
IBS = (Above/Below)
else
IBS = IBS[1];
This will make the IBS = zero (useful for zero oscillators)

Code: Select all

if Below <> 0 then
IBS = (Above/Below)
else
IBS = 0;