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

RE: [amibroker] Re: Period beteween two given dates in AFL



PureBytes Links

Trading Reference Links




The N100 signals may be applied on ^N225.
Since the Japanese market opens after the US close, we use the 
next bar Open.
The steps are

Step1.

Create the ~OUT1 ticker
// ~OUT1
// scan the N100 database for all 
quotationsKUP=EMA((H+L+C)/3,10)+EMA(H-L,10);KDOWN=EMA((H+L+C)/3,10)-EMA(H-L,10);OUT1=C<KDOWN 
AND 
Ref(C,-1)>Ref(KDOWN,-1);AddToComposite(OUT1,"~OUT1","V");AddToComposite(1,"~COUNT","V");Buy=0;

Step2.
Plot in IB the best [green] and the worse [red] scenario for every Buy 
signal.
The green line gives the max possible profit, the red line gives the max 
possible loss.
 
// ^N225 application 
X1=Foreign("~out1","V");Filter=Ref(Ref(x1,-1)>20 AND 
x1<10,-1);PlotShapes(shapeUpArrow*Filter,colorBrightGreen);p1=100*(-1+H/Ref(O,-BarsSince(Filter)));p2=100*(-1+L/Ref(O,-BarsSince(Filter)));Plot(0,"0",colorBlack,1);Plot(HighestSince(Filter,IIf(Filter,0,p1)),"\nHighest 
p1",colorBrightGreen,styleThick);Plot(LowestSince(Filter,IIf(Filter,0,p2)),"\nLowest 
p2",colorRed,styleThick);AddColumn(Ref(HighestSince(Filter,IIf(Filter,0,p1)),-1),"Highest 
p1 %");AddColumn(Ref(LowestSince(Filter,IIf(Filter,0,p2)),-1),"Lowest p1 
%");
 
Step 3.
In AA window explore ^N225 from May2003 till now with the same 
formula.
 
The gifs speak better.
Note, for example, that from  Nov20, 2003 till  Feb 6, 2004 it 
was IMPOSSIBLE to loose,
there are no red lines. All the Lows were higher than the respective 
BuyPrice !!
Dimitris Tsokakis
 
 
 
 
----- Original Message ----- 
From: <A 
title=tsokakis@xxxxxxxxx href="">Dimitris Tsokakis 

To: <A title=amibroker@xxxxxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Friday, March 12, 2004 10:44 AM
Subject: A profitable Indicator[step by step]

 
Step1.

Create  the "~OUT1" composite ticker for the N100 
market.
KUP and KDOWN are the Keltner Resistance/Support, the 
condition OUT1 occurs when a stock closes 
below the Keltner support for the first 
time.
The "~OUT1" counts how many tickers did it. 
 
// OUT1
// scan the N100 database for all 
quotationsKUP=EMA((H+L+C)/3,10)+EMA(H-L,10);KDOWN=EMA((H+L+C)/3,10)-EMA(H-L,10);OUT1=C<KDOWN 
AND 
Ref(C,-1)>Ref(KDOWN,-1);AddToComposite(OUT1,"~OUT1","V");AddToComposite(1,"~COUNT","V");Buy=0;
 
Step2.

After creating the composite ticker, paste in IB 
the
 
// BUY ARROWS
X1=Foreign("~out1","V");Filter=Ref(x1,-1)>20 AND 
x1<10;SetForeign("^NDX");Plot(C,"",1,64);PlotShapes(shapeUpArrow*Filter,colorBrightGreen);GraphXSpace=5;
 
It will plot a green arrow when the "~OUT1" changes 
dramatically from >20 to <10.
The signals are quite reliable for the recent bullish period, 
the delays are not bad and may give hints for the re-entry points.
[see Fig. 1]
 
Step3.

After creating the "~out1" composite, let us see the highest 
possible profit for a N100 stock.The daily function p1 resets to 0 at every 
buy bar and gives the highest partial profit from arrow to arrow.Paste in an 
IB window the 
 
// Highest individual 
profitX1=Foreign("~out1","V");Filter=Ref(x1,-1)>20 AND 
x1<10;PlotShapes(shapeUpArrow*Filter,colorBrightGreen);p1=100*(-1+H/Ref(O,-BarsSince(Filter)));Plot(0,"0",colorBlack,1);Plot(p1,"p1",IIf(p1>0,colorBrightGreen,colorRed),8+2);
 
Select a N100 ticker from the symbol tree to see the 
individual profits per period.
[See Fig. 2]
 
Step4.

To see the % of the profitable stocks for the whole N100 
database:
 
// Create the average p1
// scan the N100 database for all 
quotations  
X1=Foreign("~out1","V");Filter=Ref(x1,-1)>20 AND 
x1<10;p1=100*(-1+H/Ref(C,-BarsSince(Filter)));AddToComposite(p1,"~p1","C");AddToComposite(p1>0,"~profitable","v");Buy=0;
 
Step5.
 
// The average p1 
graphX1=Foreign("~out1","V");Plot(0,"0",colorBlack,1);Plot(-10,"",1,1);Filter=Ref(x1,-1)>20 
AND 
x1<10;//Plot(C,"",1,64);PlotShapes(shapeSmallUpTriangle*Filter,colorBrightGreen); 
pAV=Foreign("~p1","C")/Foreign("~count","v");Profitables=100*Foreign("~profitable","v")/Foreign("~count","v");Plot( 
5, "Ribbon",IIf( profitables>90, colorBlue,IIf(profitables>75, 
colorLightBlue,IIf(profitables>50,colorYellow,colorRed))), 
styleArea|styleNoLabel|styleOwnScale,-1,100 
);Plot(IIf(Filter,0,pAV),"pAV",IIf(pAV>0,colorBlack,colorRed),styleArea);Title="The 
"+WriteVal(profitables,1.0)+"% of the N100 stocks is profitable. The Average 
Profit since "+WriteVal(ValueWhen(Filter,DateTime()),formatDateTime)+" is 
"+WriteVal(pAV,1.2)+"%";Plot(HighestSince(Filter,IIf(Filter,0,pAV)),"",ColorLightGrey,1);
 

The profitability is, according to the ribbon color>90% 
[Blue]>75% [LightBlue]>50% [yellow]<50% [red]
You may read in the title the % of profitable stocks and the highest 
possible average profit from the Buy date.
[See Fig. 3]
 
Dimitris Tsokakis


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 the Yahoo! Terms of Service.







Attachment:
1N225out1.gif

Attachment: Description: "Description: GIF image"