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

[amibroker] IP and Hi-pass Equity for the whole Market, the MACD crossover



PureBytes Links

Trading Reference Links




We all know, more or less, that the MACD crossover system is 
another way to loose some money in the N100 market.
It is written in any T/A page<FONT face=Verdana 
size=2>
Buy=<FONT 
size=2>Cross(MACD<FONT 
size=2>(),Signal());
Sell=Cross(Signal(),MACD());
as a trading system example, but the N100 
results from Jan 2000 till now is nothing but a horrible -30% 
[it was a steady -50% during the bearish 
period...]
The IP method has a different approach.
It is clear from the 2nd inspection, back on Jan2001, that #76 
[PSFT] is a good candidate for this dangerous system.
PSFT is the steady choice for IP1 till IP5, as you may 
see from
 
// Trade the top Equity stock 
// arranged  for the MACD crossover trading 
system
START=DateNum()==1000530 
;per=Param("per",150,130,160,5);EVENT=BarsSince(START)%per==0;EXIT=Ref(EVENT,1);Plot(10000,"",Cum(1)%2,1);Plot(0,"",1,styleNoLine);Counter=Cum(EVENT)%10;shape=IIf(Counter==1,shapeDigit0,IIf(Counter==2 
,shapeDigit1,IIf(Counter==3 ,shapeDigit2,IIf(Counter==4 
,shapeDigit3,IIf(Counter==5 ,shapeDigit4,IIf(Counter==6 
,shapeDigit5,IIf(Counter==7 ,shapeDigit6,IIf(Counter==8 
,shapeDigit7,IIf(Counter==9 
,shapeDigit8,shapeDigit9)))))))));
PlotShapes(shape*EVENT,colorIndigo);G=0;NUM=254;
list = GetCategorySymbols( categoryGroup, NUM );for( i = 
0; ( sym = StrExtract( list, i ) ) != ""; i++ 
){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(MACD(),Signal());Sell=Cross(Signal(),MACD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);T11=ValueWhen(EVENT,Cum(1));G=IIf(G>E11,G,E11);}D=0;F=0;list 
= GetCategorySymbols( categoryGroup, NUM );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ ){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(MACD(),Signal()) ;Sell=Cross(Signal(),MACD()) 
;E1=Equity(1,0);E11=ValueWhen(EVENT,E1);G11=ValueWhen(EVENT,G);D1=IIf(E11==G,i,0);D=D+D1;EE=IIf(E11==G,E1,0);F=F+EE;}STEP=IIf(EVENT,F-Ref(F,-1),0);T=Cum(STEP);Plot(F-T,"",IIf(EVENT,colorRed,colorBlack),8);Title="Group 
"+WriteVal(num,1.0)+", TopEquity Stock is # "+ 
"["+WriteVal(D,1.0)+"]"+WriteIf(EVENT,"*  ","  
")+WriteVal(F-T);SetForeign(StrExtract(LIST,48),True,True);Buy=Cross(MACD(),Signal()) 
;Sell=Cross(Signal(),MACD()) 
;E0=Equity(1,0);Plot(E0,"",colorBlue,1);SetForeign(StrExtract(LIST,76),True,True);Buy=Cross(MACD(),Signal()) 
;Sell=Cross(Signal(),MACD()) 
;E0=Equity(1,0);Plot(E0,"",colorRed,1);
 
IDPH [#48, blue line] is the very next competitor to the 
long-time champion PSFT [#76, red line] and may be the nextIP selection, if 
some traders still insist to this MACD game.IP method may protect MACD 
traders from loosing some money by trading various N100 great stocks with 
theMACD crossover system.Dimitris Tsokakis
 
----- Original Message ----- 
From: <A 
title=tsokakis@xxxxxxxxx href="">Dimitris Tsokakis 

To: <A title=amibroker@xxxxxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Friday, October 17, 2003 12:13 PM
Subject: Fw: Inspection Points and Hi-pass Equity for the whole 
Market, part II

The 
systemBuy=Cross(StochD(),30);Sell=Cross(80,StochD());was applied 
over the N100 database from Jan2000 till now.The HiEquity-pass filter 
selected for various Inspection Points [IP] theNVDA, at IP0ADBE, at 
IP1CPWR, from IP2 to IP7 andSYMC at IP8.At each IP the [blue] ground 
level G is defined. It is the value of the Equity() for this date.See how it 
works.The black line is the Equity of the selected stock from IP to the next 
IP.At IP2 [point A] the system selected CPWR [ yellow Equity line] and, 
since CPWR was the top Equity stock for IP3, IP4, IP5, IP6 and IP7, there 
was no reason to change stock.The decision at A was to sell ADBE, buy CPWR 
and follow CPWR signals until the IP8. All this period SYMC Equity [red 
line] was growing up and, some days before IP8 [point B] crossed the CPRW equity 
lineabd became the top Equity stock.The IP8 decision was to sell CPRW, 
buy SYMC and follow SYMC trades until the next IP9.   These 
details come from the Ind. builder code
// A HiEquity-pass filterSTART=DateNum()==1000530 
;Title="TOP EQ 
STOCK";EVENT=BarsSince(START)%101==0;Plot(2000,"",1,1);Plot(10000,"",Cum(1)%2,1);PlotShapes(shapeCircle*EVENT,colorRed);G=0;CountER=0;list 
= GetCategorySymbols( categoryGroup, 254 );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ ){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(StochD(),30);Sell=Cross(80,StochD());E1=Equity(1,0);//Plot(E1,"\n["+WriteVal(CountER,1.0)+"]",Counter+40,1);E11=ValueWhen(EVENT,E1);T11=ValueWhen(EVENT,Cum(1));G=IIf(G>E11,G,E11);CountER=CountER+1;}Plot(G,"\nG",colorBlue,8);CountER1=0;D=0;list 
= GetCategorySymbols( categoryGroup, 254 );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ ){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(StochD(),30);Sell=Cross(80,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);//Plot(E11,"\n["+WriteVal(CountER1,1.0)+"]",Counter1+40,1);G11=ValueWhen(EVENT,G);D1=IIf(E11==G,CountER1,0);D=D+D1;EE=IIf(E11==G,E1,-1E10);Plot(EE,"",1,1);CountER1=CountER1+1;}Title=Title+" 
["+WriteVal(D,1.0)+"]"+WriteIf(EVENT," * ","");
 
<FONT 
size=2>SetForeign(StrExtract(List,92),True,True);Buy=Cross(StochD(),30);Sell=Cross(80,StochD());E0=Equity(1,0);Plot(E0,"",4,8);SetForeign(StrExtract(List,25),True,True);Buy=Cross(StochD(),30);Sell=Cross(80,StochD());E0=Equity(1,0);Plot(E0,"",7,8);
 
Now, we should eliminate the [blue] G discontinuities and come 
closer to the real facts.This is done by the // Trade the top 
Equity stockSTART=DateNum()==1000530 
;per=Param("per",101,90,110,1);EVENT=BarsSince(START)%per==0;EXIT=Ref(EVENT,1);Plot(10000,"",Cum(1)%2,1);Plot(0,"",1,styleNoLine);Counter=Cum(EVENT)%10;shape=IIf(Counter==1,shapeDigit0,IIf(Counter==2 
,shapeDigit1,IIf(Counter==3 ,shapeDigit2,IIf(Counter==4 
,shapeDigit3,IIf(Counter==5 ,shapeDigit4,IIf(Counter==6 
,shapeDigit5,IIf(Counter==7 ,shapeDigit6,IIf(Counter==8 
,shapeDigit7,IIf(Counter==9 
,shapeDigit8,shapeDigit9)))))))));PlotShapes(shape*EVENT,colorIndigo);G=0;NUM=254;BuyLEVEL=Param("b",30,10,50,5);SellLEVEL=Param("s",80,50,95,5);list 
= GetCategorySymbols( categoryGroup, NUM );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ ){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(StochD(),BuyLEVEL);Sell=Cross(SellLEVEL,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);T11=ValueWhen(EVENT,Cum(1));G=IIf(G>E11,G,E11);}D=0;F=0;list 
= GetCategorySymbols( categoryGroup, NUM );for( i = 0; ( sym = StrExtract( 
list, i ) ) != ""; i++ ){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(StochD(),BuyLEVEL) ;Sell=Cross(SellLEVEL,StochD()) 
;E1=Equity(1,0);E11=ValueWhen(EVENT,E1);G11=ValueWhen(EVENT,G);D1=IIf(E11==G,i,0);D=D+D1;EE=IIf(E11==G,E1,0);F=F+EE;}STEP=IIf(EVENT,F-Ref(F,-1),0);T=Cum(STEP);Plot(F-T,"",IIf(EVENT,colorRed,colorBlack),8);Title="Group 
"+WriteVal(num,1.0)+", TopEquity Stock is # "+ 
"["+WriteVal(D,1.0)+"]"+WriteIf(EVENT,"*","");
 
A STEP function was introduced to measure the discontinuity 
gap [positive or negative] and the T=Cum(STEP) will act for the whole range, 
adding or subtracting at each IP the respective STEP.The final Equity line 
is continuous and is closer to the reality [some commissions are missing, when, 
for examplethe system sells CPWR at IP8 without a regular Sell signal and 
Buys SYMC without the respective regular Buy signal]This method decisions 
wereIP0 : Buy and Trade NVDAIP1 : Sell NVDA, Buy and Trade ADBEIP2 : 
Sell ADBE, Buy and Trade CPWRIP3 to IP7 : Keep on trading CPWRIP8 : Sell 
CPWR, Buy and Trade SYMC 
Let us see now if it is interesting.The final Equity value 
is 41,114.5.The 
Buy=Cross(StochD(),30);Sell=Cross(80,StochD());over the whole N100 
for the same period and settings gives a total net profit -3.5%.41 stocks 
were profitable up to +390% and the rest 60 were loosing money [15 stocks were 
below -75%...]
 
Dimitris Tsokakis
----- Original Message ----- 
From: <A 
title=tsokakis@xxxxxxxxx href="">Dimitris Tsokakis 

To: <A title=amibroker@xxxxxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, October 16, 2003 11:17 AM
Subject: Inspection Points and Hi-pass Equity for the whole Market, 
part I

The code will choose the top Equity stock at the 
Inspection Point [IP] and will trade all its [individual] signals up to the next 
inspection.
The procedure will be repeated for every future 
inspection.
The Equities at an inspection point are counted from the 
beginning of the available data.
All stocks should be aligned, missing bars should be filled 
before the research.
The starting and ending date for all stocks should be the 
same
The application is effective from Amibroker 4.44.1, Oct12, 
2003, when the 
SetForeign( ticker, fixup = True, tradeprices = 
False)
was implemented *
The selected stock at IP had an Equity value G. It is the 
ground level for the next trades and is plotted as a blue thick 
line.
Up to the next IP we may see if the selected top stock was 
profitable [Eq>G] or not [Eq<G].
The black line is the Equity from IP to IP.
How does it work : At the Inspection point X, for 
example, PETM was the top Equity stock [see PETM red equity 
line]
The code selected PETM and followed its trades up to now [PETM 
was the top stock for the next two IPs too !!]
 
// A Hi-pass Equity filter at the Inspection 
PointsSTART=DateNum()==1000530 ;Title="TOP EQ 
STOCK";EVENT=BarsSince(START)%101==0;Plot(2000,"",1,1);Plot(10000,"",Cum(1)%2,1);PlotShapes(shapeCircle*EVENT,colorRed);G=0;CountER=0;list 
= GetCategorySymbols( categoryGroup, 254 );// group IDfor( i = 0; ( sym = 
StrExtract( list, i ) ) != ""; i++ 
){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(StochD(),30);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);T11=ValueWhen(EVENT,Cum(1));G=IIf(G>E11,G,E11);CountER=CountER+1;}Plot(G,"\nG",colorBlue,8);CountER1=0;D=0;list 
= GetCategorySymbols( categoryGroup, 254 );// group IDfor( i = 0; ( sym = 
StrExtract( list, i ) ) != ""; i++ 
){SetForeign(SYM,True,True);global Buy;global 
Sell;Buy=Cross(StochD(),30);Sell=Cross(50,StochD());E1=Equity(1,0);E11=ValueWhen(EVENT,E1);G11=ValueWhen(EVENT,G);D1=IIf(E11==G,CountER1,0);D=D+D1;EE=IIf(E11==G,E1,-1E10);Plot(EE,"",1,1);CountER1=CountER1+1;}Title=Title+" 
["+WriteVal(D,1.0)+"]"+WriteIf(EVENT," * 
","");SetForeign("PETM",True,True);Buy=Cross(StochD(),30);Sell=Cross(50,StochD());E0=Equity(1,0);Plot(E0,"",4,8);//Plot(D,"",1,styleOwnScale);
 
Notes
1. The 100 N100 stocks and the index ^NDX are placed in my 
Group254.
If your stocks are in the WatchList5, for example, you should 
change the // group ID lines as follows
 
list = GetCategorySymbols( categorywatchList, 5 
);//
 
2. The
Buy=Cross(StochD(),30);Sell=Cross(50,StochD());was 
used as example of the trading system.
Settings were arranged in AA window 
Buy, Sell at Open
Delay +1
commission 0.25%
all stops disabled
initial equity 10000
3. G [thick blue line] is the ground level, the equity value 
for the selected stock at the IP.
As you see, even for the top stocks, the system was not quite 
profitable, the [black] individual Equity lines 
are frequently below their Ground level G.
4. D is the ordinal # of the stock in the database. You may 
uncomment the last line to see the top Ds.
If you place your cursor on some bar, you will read D in the 
title.
An asterisk * will appear at each IP bar. As you 
see, on Oct20, 2000 the system sold #67 [NVDA] to buy
the new top stock #2 [ADBE] 
5. The graph is universal and will not change as you move from 
ticker to ticker in your symbol tree.
 
This is the basic idea, to ride on the top equity 
stock.
The expectation is a follow up, at least up to the next IP. 

If negative, the inspector will search for the new rising star 
of the show, right at the next IP !!
More details in part II, hopefully today...
Dimitris Tsokakis 
 
* From the 4.44.1 Readme.html




SetForeign( ticker, fixup = True, tradeprices = False) and 
RestorePriceArrays( tradeprices = False ) have new flag now: tradeprices 
(False by default)



when tradeprices is set to TRUE, then not only OHLC, V, OI, 
Avg arrays are set to foreign symbol values, but also BuyPrice, SellPrice, 
ShortPrice, CoverPrice, PointValue, TickSize, RoundLotSize, MarginDeposit 
variables are set to correspond to foreign 
security.



This allows Equity() to work well with 
SetForeign.






Yahoo! Groups Sponsor


  ADVERTISEMENT 









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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



Attachment:
IP3.gif

Attachment: Description: "Description: GIF image"