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

Re: [amibroker] Artificial Intelligence, an introduction, ^N225 2003



PureBytes Links

Trading Reference Links

Hi Dimitris,

Wednesday, December 17, 2003, 10:17:42 PM, you wrote:

First of all, what a wonderful treat to see this.  Thank you very
much for putting time into the 225.  I can't tell you how much I
appreciate it.  Rest in line below:

DT> What could we do not to miss the move ? Here is the elementary 
DT> AI proposal:

DT> The first significant ^N225 trough was on Jan31, 2003 and the 
DT> very next significant peak was on Feb17.
DT> Suppose we follow this pattern and 
DT> then buy every x1 days after the first buy and sell every x2 days after the
DT> first sell.
DT> By the end of the first 6 months we try to learn the rhythm of 
DT> the market and trade it for the next 6 months.
DT> The initial rhythm may need 
DT> corrections as the market changes, inspections every 15-20 days are
DT> necessary.

Okay . . . question one is how do we do the inspections?  Remember, I
am severely handicapped at understanding such complex code.  ^_^

DT> The results are interesting:
DT> There were 3 main rhythm 
DT> combinations [x1,x2], the [29,24] for 34 days, the [26,33] for the next 34 days
DT> and, finally, 
DT> a potential combination [25,28] was detected around mid 
DT> September and it is valid untill now.
DT> Another important issue : The system 
DT> "understood" around mid July that x1 should be < x2. 
DT> It means buys should 
DT> be more frequent than sells, a characteristic of bullish markets 
DT> [the more 
DT> you delay a Sell, the more part of the bullish trend you enjoy...]
DT> The black 
DT> [29,24] equity line was a nice solution up to the end of July, the white [26,33]
DT> up to the middle of August.
DT> The red [25,28] was the most tenacious all year 
DT> long.

Absolutely cannot argue with these results.  They are great.

DT> The trading parameters are

DT>    Settings      Initial Equity: 10000 Periodicity/Positions:
DT> Daily/Long Short  Commissions: 0.50 %  Annual interest rate:
DT> 0.00%  Range: 30/5/2003 00:00:00 - 17/12/2003  Apply to: Current
DT> Symbol  Margin requirement: 100  Futures mode: No  Def. round lot
DT> size: 0  Def. Tick Size 0  Drawdowns based on: Open prices     
DT> Long trades  Buy price: Open  Sell price:  Open  Buy delay: 1
DT> Sell delay:  1  Short trades  Short price: Open  Cover price:
DT> Open  Short delay: 1  Cover delay:  1  Stops  Maximum loss:
DT> disabled  Profit target:  disabled  Value: 30.00  Value:  20.00
DT> Exit at stop? yes  Exit at stop?  no     Trailing stop: disabled
DT>       Value: 5.00        Exit at stop? no      

Okay, this below I save in my system formulae folder.  I shall call
it 225 Timer System by Dimitris Tsokakis.

DT>    FormulaSYM="^N225";in=DateNum()>=1030530; 
DT> STARTBUY=DateNum()==1030131; 
DT> STARTSELL=DateNum()==1030217; 
DT> startIP=DateNum()==1030530; 
DT> x=17; 
DT> // A Hi-pass filter 
DT> EVENT=BarsSince(startIP)%x==0; 
DT> k0=20;Plot(k0,"k0",Cum(1)%2,1);s0=60; 
DT> shape=33+2*(Cum(event)%10); 
DT> PlotShapes(shape*EVENT,colorRed); 
DT> Plot(0,"",1,1);Plot(100,"",1,1);Slevel=80; 
DT> G=0; 
DT> for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++) 
DT> { 
DT> for(SellFREQ=10;SellFREQ<40;SellFREQ++) 
DT> { 
DT> Buy=BarsSince(STARTBuy)%Buyfreq
DT> ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy; 
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
DT> e1=Equity(1,0);E11=ValueWhen(EVENT,E1);G=IIf(G>E11,G,E11); 
DT> }} 
DT> BFpass=0;SFpass=0; 
DT> for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++) 
DT> { 
DT> for(SellFREQ=10;SellFREQ<40;SellFREQ++) 
DT> { 
DT> Buy=BarsSince(STARTBuy)%Buyfreq
DT> ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy; 
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
DT> e1=Equity(1,0); 
DT> E11=ValueWhen(EVENT,E1); 
DT> BF1=IIf(E11==G,BuyFREQ,0);BFpass=BFpass+BF1; 
DT> SF1=IIf(E11==G,SellFREQ,0);SFpass=SFpass+SF1; 
DT> G=IIf(E11==G,0,G); 
DT> }} 
 
DT> Buy=BarsSince(STARTBuy)%bfpass
DT> ==0;Sell=BarsSince(STARTSell)%sfpass==0;Short=Sell;Cover=Buy; 
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);

DT>    Overall performance summary

Very good of course.  Excellent.  I am not getting *exactly* the same
numbers you are, but they are very close.  Let's not worry about that
at this moment; I will recheck my settings.  The numbers are very
close, however.

DT> For Indicator builder see the timing coefficients variations 
DT> and the more important equity lines with the code

DT> // ^N225 timing for 
DT> 2003
DT> STARTBUY=DateNum()==1030131;// first 
DT> trough
DT> STARTSELL=DateNum()==1030217;// first 
DT> peak
DT> startIP=DateNum()==1030530;// inspections and trading 
DT> start
DT> x=17;
DT> // The Hi-pass 
DT> filter
DT> EVENT=BarsSince(startIP)%x==0;
DT> k0=10;Plot(k0,"k0",Cum(1)%2,1);
DT> s0=60;
DT> shape=33+2*(Cum(event)%10);
DT> PlotShapes(shape*EVENT,colorIndigo);
DT> Plot(0,"",1,1);
DT> Plot(50,"",1,1);
DT> G=0;
DT> for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++)
DT> {
DT> for(SellFREQ=10;SellFREQ<40;SellFREQ++)
DT> {
DT> Buy=BarsSince(STARTBuy)%Buyfreq 
DT> ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
DT> e1=Equity(1,0);E11=ValueWhen(EVENT,E1);G=IIf(G>E11,G,E11);
DT> }}
DT> BFpass=0;SFpass=0;
DT> for(BuyFREQ=10;BuyFREQ<40;BuyFREQ++)
DT> {
DT> for(SellFREQ=10;SellFREQ<40;SellFREQ++)
DT> {
DT> Buy=BarsSince(STARTBuy)%Buyfreq 
DT> ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
DT> e1=Equity(1,0);
DT> E11=ValueWhen(EVENT,E1);
DT> BF1=IIf(E11==G,BuyFREQ,0);BFpass=BFpass+BF1;
DT> SF1=IIf(E11==G,SellFREQ,0);SFpass=SFpass+SF1;
DT> G=IIf(E11==G,0,G);
DT> }}
DT> Plot(BFPASS,"\nBFpass",colorBlack,8);Plot(SFPASS,"SFpass",colorBlue,8);

DT> // the 3 main equity lines

DT> BuyFREQ=29;SellFREQ=24;
DT> Buy=BarsSince(STARTBuy)%Buyfreq 
DT> ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
DT> e1=Equity(1,0);
DT> Plot(E1,"["+WriteVal(Buyfreq,1.0)+","+WriteVal(Sellfreq,1.0)+"]",colorblack,8+styleLeftAxisScale);


DT> BuyFREQ=26;SellFREQ=33;
DT> Buy=BarsSince(STARTBuy)%Buyfreq 
DT> ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
DT> e1=Equity(1,0);
DT> Plot(E1,"["+WriteVal(Buyfreq,1.0)+","+WriteVal(Sellfreq,1.0)+"]",colorwhite,8+styleLeftAxisScale);


DT> BuyFREQ=25;SellFREQ=28;
DT> Buy=BarsSince(STARTBuy)%Buyfreq 
DT> ==0;Sell=BarsSince(STARTSell)%Sellfreq==0;Short=Sell;Cover=Buy;
DT> Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
DT> e1=Equity(1,0);
DT> Plot(E1,"["+WriteVal(Buyfreq,1.0)+","+WriteVal(Sellfreq,1.0)+"]",colorred,8+styleLeftAxisScale);

Okay, no problems getting that middle chart you have, showing the 3
equity lines.

I'm having two problems however: 1) Where does that bottom chart come
from? 2) I can't seem to get trade arrows on my price chart for this.
I know I should be able to right click the trade list in AA and
select this, but it doesn't seem to be working.

Yuki (who still does not understand, but will)


Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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/