Internal Bar Strength (IBS)

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Internal Bar Strength (IBS)

Postby LRP » 04 Jun 2013

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

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Internal Bar Strength (IBS)

Postby TJ » 04 Jun 2013

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.

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Internal Bar Strength (IBS)

Postby LRP » 04 Jun 2013

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

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Internal Bar Strength (IBS)

Postby TJ » 04 Jun 2013

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

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Internal Bar Strength (IBS)

Postby LRP » 04 Jun 2013

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")

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Internal Bar Strength (IBS)

Postby TJ » 04 Jun 2013

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?

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Internal Bar Strength (IBS)

Postby TJ » 04 Jun 2013

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".

User avatar
LRP
Posts: 153
Joined: 07 Apr 2008
Location: Switzerland
Has thanked: 96 times
Been thanked: 15 times

Re: Internal Bar Strength (IBS)

Postby LRP » 04 Jun 2013

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?

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Internal Bar Strength (IBS)

Postby TJ » 04 Jun 2013

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;


Return to “User Contributed Studies and Indicator Library”