[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EquisMetaStock Group] Expert Symbol/Alert problem



PureBytes Links

Trading Reference Links

Hi Harry

> You now force me to show my ignorance <g>. I don't understand why you
wrote the Alert (a=0,2) as you did. I assume the first part means it is TRUE
only when the Close and the Moving Average are equal? And why do you hold it
for 2 days?

You're the second person that's written to ask me the very same thing.
Rather than go through the whole explanation again I'll see if i can look
out my previous response and add to the end of this note. In essence what
you need to understand with binary logic is that it can have one of two
states - true or false (one or zero, active or inactive). When a variable or
expression is true its "flip side" is false. If 'X' is true then 'X=0' is
false, and conversely if 'X' is false then 'X=0' is true. I can test either
the normal or reverse side of an expression. All an Alert() does is extend
an expression that is true for the required number of extra bars. My use of
Alert simply compares the normal (positive) side of an expression with its
reverse side while extending one of them for an extra bar. The one bar
overlap is either the leading edge or trailing of a signal that has changed
from one state to another. You really need to play with some of these issues
on a chart, just fooling around with a test indicator. I can knock up an
example (with code and chart display) and post if it would help.

> Second, you need to expand somewhat on the N/A bars. Why does adding a
condition (such as Cross or Ref) increase the number of bars by one, and why
does this affect the amount of data available to be used from the "left
side" of the chart?

Drop a 20 period moving average onto a chart (shorter is OK but change my
numbers accordingly) then look at the left of the chart and see where the MA
starts - it will start on the 20th bar. The bars before that are so-called
N/A bars. The indicator is being formed but won't display untill all the
necessary data points are added in.

Now make a new indicator (just leave it called <new indicator> if you like)
and add the following code,
Cross(C,Mov(C,20,S));
drop it onto any chart window (unscaled is probably best) and notice where
the first displayed bar is - bar 21 I'll bet.

Next change the code to
C>Mov(C,20,S) and Alert(C>Mov(C,20,S)=0,2);
and notice that the display starts at 20 bars now.

Now change to
Ref(Cross(C,Mov(C,20,S)),-5);
which starts at 26 bars now.

Each time an N/A (nul or no-output) bar is added to a variable it can't be
eliminated from subsequent variables that use previous code in some way. In
other words the number of non-displayed bars is cumulative. You can't use an
N/A bar logically except in very unusual circumstances, so if you are
back-testing you are effectively unable to access some of your data. What
happens is that the first usable entry signal for the period under test may
be missed so the result you get is not as accurate as it could be.

I have evolved a number of techniques for eliminating this sort of problem
from my testing, and using Alert() instead of Ref() for for creating delays
to binary signals is one of them.

Hope this is not too confusing.


Regards

Roy

{text from a previous off-list post}

> Why do use "stop=0,2" or " sigtl=0,2" (is it 0.2?) and why not another
> number?

These are usually contained in an Alert() function, as in Alert(sigtl=0,2).
What I am doing is testing "sigtl" for false (zero) and then extending that
binary value for a second bar. The "2" is a parameter of Alert(). If I was
to write my expression fully and with comments it would look like this

{code to find the leading edge of 'sigtl' i.e. show only the first bar that
'sigtl' is true}

sigtl=TRUE AND Alert(sigtl=FALSE,2);  {hold the reverse of 'sigtl' true for
one more bar}

This code will give a 1 bar spike true when 'sigtl' first goes true. 'sigtl'
was previously false, that is to say 'sigtl=FALSE' was true, and the Alert
holds it true for one more bar so both conditions are true together for just
one bar}

Another way I could write this is
sigtl=TRUE AND Ref(sigtl,-1)=FALSE;

Think long and hard about what I have tried to explain with using the
Alert() function. An Alert() function can extend a binary TRUE value for any
given number of bars (periods). Suppose variable 'A' is true (or active, or
one) then it follows that 'A=0' is false (or inactive, or zero). And if 'A'
is false then 'A=0' must be true. I use this 'A=0' true and extend it by one
bar with the alert function. I am using the two sides of the 'A'  variable
(the TRUE side and the FALSE side) to give me a one bar overlap. Simple but
not easy for everyone to get their head around.



To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/