PureBytes Links
Trading Reference Links
|
Yuki, Graham,
Here is a simple amibroker exploration to check any logic operation.
1 stands for true, 0 stands for false.
//Truth tables, by D. Tsokakis, end July 2004
//EXPLORE CURRENT STOCK FOR THE LAST 4 QUOTATIONS
A=Cum(1)%2==0;
B=int(Cum(1)/2)%2==0;
Filter=1;
AddColumn(A,"A",1.0);
AddColumn(B,"B",1.0);
AddColumn(A AND B,"A AND B",1.0);
AddColumn(NOT(A AND B),"NOT(A AND B)",1.0);
AddColumn(NOT(A) AND NOT(B),"NOT(A) AND NOT(B)",1.0);
You will easily recognize that the last two columns are not identical.
You may add more columns [ A OR B, NOT(A OR B), A AND NOT(B) etc]
I hope this code will help to avoid logic traps [without studying the
interesting science of the Mathematical Logic. I hope R. Carnap will
excuse me, but we are amibroker users of 2004 !!]
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> Yuki
> If something is true when 2 conditions exist, then reversing both
conditions
> does not make the inverse something true. Confusing, yes. :)
Another way is
> that you must also take into account all 4 condition options. It
takes 3
> options to invert 1 option
> 1st option >= and >=
> 2ndoption >= and <
> 3rd option < and >=
> 4th option < and <
>
> to invert the 1st then you must specify all of the remaining 3
options.
>
> A simpler way is just to say "Not option 1" like this
>
>
> AND not ( (Ref(Foreign("^225", "Close"),-1) >=
> Ref(Foreign("^225","Close"),-2) * 1.01 AND Ref(Foreign("^IXJ",
> "Close"),-1) >= Ref(Foreign("^IXJ", "Close"),-2) * 1.01) );
>
>
>
> Cheers,
> Graham
> http://e-wire.net.au/~eb_kavan/
>
> -----Original Message-----
> From: Yuki Taga [mailto:yukitaga@x...]
> Sent: Saturday, July 31, 2004 12:12 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] logic problem
>
> I have a system than runs short term trades, both long and short. I
> notice that on days when the market is very strong, say the Nikkei
> AND TOPIX are both up more than 1 percent (I'll use 1.1 percent in
> the example to follow), taking short signals generated by my system
> the next day is ill advised.
>
> I prove this by appending the following to my short statement:
>
> AND (Ref(Foreign("^225", "Close"),-1) >=
> Ref(Foreign("^225","Close"),-2) * 1.01 AND Ref(Foreign("^IXJ",
> "Close"),-1) >= Ref(Foreign("^IXJ", "Close"),-2) * 1.01);
>
> (^225 is the symbol for the Nikkei 225 and ^IXJ is the symbol for
the
> TOPIX)
>
> Now, the system ONLY takes shorts in the case I outlined in the
first
> paragraph (market was quite powerful the day before), and the shorts
> are a losing proposition. Ever slightly more losers, and losers
> average larger than winners, and the return on shorting is negative.
>
> I am not at all surprised. The total number of shorts involved here
> is rather small, 23 out of 323 shorts when I don't worry at all
about
> the previous day's market direction or strength. I am also not
> surprised it is a small number. That kind of volatility (market up
> strongly one day but large cap stocks signalling short on my system
> the next day) is not that common. But eliminating any unprofitable
> element from a profitable system makes a good system even better.
>
> However, when I run what I think is the reverse of this, appending
> the following to the short statement in an attempt to eliminate
> *only* those 23 shorts . . .
>
> AND (Ref(Foreign("^225", "Close"),-1) <
> Ref(Foreign("^225","Close"),-2) * 1.01 AND Ref(Foreign("^IXJ",
> "Close"),-1) < Ref(Foreign("^IXJ", "Close"),-2) * 1.01);
>
> . . . I end up eliminating 118 short trades (number of shorts is now
> 205 versus 323). And the total return is now lower than it is with
> the plain vanilla system, run with no reference to the previous
day's
> indices. Obviously, I am losing too many good shorts, in addition to
> the 23 that I want to lose. Otherwise, I should be money ahead if I
> have a profitable system that I have just subtracted an unprofitable
> element from. But I'm cutting out more than I want to.
>
> So, before I lose my mind ^_^ can someone give me an idea where I
> might look to find the reason that so many short trades are
> evaporating on the second example? All trades are either 2-bar or
> 3-bar trades. I cannot understand why there is such a discrepancy.
>
> In all three cases . . . (completely unmodified, taking only the
> expected bad shorts, and trying to eliminate only the known bad
> shorts) the number of long trades does not vary by a single trade --
> there are always 548 long trades in each case. So it's not a matter
> of interaction between the long and short sides, and not a matter of
> not enough cash or anything simple like that. Whatever it is
though,
> my head doesn't get it, and I need some help.
>
> Yuki (who has a headache from tying to figure this out)
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|