Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
I just put my "lets be cynical and critically look at some code" hat on and came back to visit these codes.
Although we congratulate Patibanda for his view of the market refllected in this code, I emphasise yet again the dangers of taking any code at face value without carefully scrutinising every line and function.
This is not any sort of attack on the author, but a demonstration of how all codes should be analysed before use.
--
Looking at the Where Bear Dares 1 code :
Div(Div(O-L-H-C,2)+Div(O+L+H+C,4),2);0
{Swing Or Close,at -ve Value,"Bull"; At +ve Value the end of Bull.}
We can simplify the expression as :
(3*O-H-L-C)/8
Now the multiplier of 1/8 is just a scalar, so can be ignored. The shape of the resultant graph will be the same without a scalar as with the scalar, but just the value at each point will be different, so we re-write the code more simply again as:
3*O-H-L-C;
The instructions for interpretting/using the code as provided:
{Swing Or Close,at -ve Value,"Bull"; At +ve Value the end of Bull.}
or saying it another way:
If the indicator is below zero, the short term trend is bullish, otherwise the short term trend is bearish.
What does it take for the indicator to be above or below zero? Using the simplified code it is easier to see what conditions are required to generate bull or bear signals, this was not so obvious from the code originally posted: The indicator is precariously balanced at zero.
--
We can apply similar logic to the second formula for Where Bear Dares 2:
Div(O-L-H-C,2)
{Bear Dares Below this value}
Again the divisor is just a scalar, so can be safely omitted without affecting the shape of the plot, just the scale.
(O-L-H-C)
{Bear Dares Below this value}
We notice this result will always be less than zero, so we will introduce a scalar to ensure the result is always more than zero, again without affecting the shape of the plot (in fact we will be reflecting the plot about the zero axis) by multiplying by (-1):
-(O-L-H-C)
which simplifies as:
(-O+L+H+C)
We notice the resultant reflected plot has an exceptionally similar shape to the original price plot, but just at twice the price, so we introduce another scalar, this time we multiple by 0.5, or divide by 2:
(-O+L+H+C)/2
Now lets pretend for the majority of time the opening price and closing price are equal or very nearly equal (we can test this assumption by summing the open-close price over the life of the stock and observe for the majority of stock this value tends towards zero i.e the open and closing prices are almost equal over time). We can then assume that on average (-O+C)=0, so we are left with:
(L+H)/2
which is of course the built in MS function MP().
We can also note, for just about all time for all stocks, the difference between:
MP() = (H+L)/2
and
Typical() = (H+L+C)/3
and
(O+H+L+C)/4
and
Bears 2 is very small, small enough not to be considered significant?
In any case, the indicator will of course be bearinh when it is moving down because it follows the price movements exactly, and the same when it is moving up!
--
Careful scrutiny of the code has shown it might be of limited value for most people, however the author has obviously fitted it into his trading system.
Hopefully, this post might serve as a demonstration on how to take code apart to see how it works. Maybe not so much on this forum, but there are people attempting to baffle brains with bullsh1t, or what I call junk code, and you'd surprised how many so-called "intelligent" people fall for line after line after complicated line of confusing and self-fulfilling code. Without careful analysis, you'd fail to see that many codes are just misleading.
Hope this helps.
|