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

RE: [amibroker] Kill the Line - Help



PureBytes Links

Trading Reference Links

I can't see why it does double counts the stocks, got me beat. Maybe someone
else can determine why. I obviously have a small error somewhere but I can't
see it.

Cheers,
Graham
http://e-wire.net.au/~eb_kavan/

-----Original Message-----
From: john gibb [mailto:jgibb1@xxxxxxxxxxxxx] 
Sent: Wednesday, July 07, 2004 4:49 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Bullish Percent Index #4 PF plot

Hi Graham,

I finally got around to checking out your code.

FWIW, i scanned a watchlist containing the following 22 US nanotech stocks:

    ACCL,ACO,ALTI,BPA,CBMX,CBT,FEIC,FLML,HDWR,IMMC,JMAR,KOPN,MTSC
,NANX,NGEN,NVEC,SKYE,TGAL,TINY,UTEK,VECO,WEDX

and scanned my EOD data for "n last days" and "n=1".

I have not yet changes box size or reversal amount, but one strange result
is that both your Line chart and Pnf Charts report twice as many (44) stocks
as are in my watchlist. (I did set atcFlagDefaults to "7" and reran the
Scan)

-john
----- Original Message ----- 
From: "Graham" <gkavanagh@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, June 30, 2004 6:06 PM
Subject: [amibroker] Bullish Percent Index #4 PF plot


Hi again, just me. Here is the P&F plot of the BPI
As a caution only view this with the ticker ~bullpercent selected.
Comments and suggestions appreciated on this series of afl codes.
Eg Does it work and is it similar to other sources?

A suggestion for everyone is to tailor the box sizes to suit your market in
the file for creating the composite (refer #2 email). The box sizes as used
are those from the stockcharts site, and I feel these are not suitable for
all markets as they may have different normal price ranges.
Eg ASX reduce the ranges to that within the normal range.
Here is a suggestion
0 - 0.1            0.001
0.1 - 0.4         0.0025
0.25 - 1          0.005
1 - 2               0.01
2 - 4               0.02
4 - 8               0.05
8 - 16             0.1
16 - 100         0.2
100 - 1000     1
1000 - 2000 10
2000+          20

Maybe the Japanese market needs more larger price ranges to suit the yen.

Cheers,
Graham
http://e-wire.net.au/~eb_kavan/




// BPI Chart - P&F
// VIEW ONLY the composite ticker ~BullPercent produced in "BPI System Base"
// Errors may occur if another ticker is viewed with this chart open.
// Graham Kavanagh  01 Jul 2004


SetBarsRequired(100000,100000);


box = 2;
reverse = 3*box;

CX = C/V*100;
CF = ceil(Cx);
CR = floor(Cx);

Bar = BarIndex();
BarDate = DateNum();
BarTurn = 0;
DateTurn = 0;
DateEnd = 0;
BarEnd = 0;

// initialize first element
j = 0;
PFC[j] = CF[0];
PFO[j] = CF[0] + box;

down = 1;  // By default the first bar is a down bar.
up = 0;

// perform the loop that produces PF Chart
for( i = 1; i < BarCount; i++ )
{
 if( CF[i] <= PFC[j] - box && down)   //continue down
 {
  PFC[j] = CF[i];
  PFO[j] = CF[i] + box;
  DateEnd[j] = BarDate[i];
  BarEnd[j] = Bar[i];
 }
 else
 {
  if( CR[i] >= PFC[j] + Reverse && down)  //Change direction to up
  {
   j++;
   up = 1;
   down = 0;
   PFC[j] = CR[i];
   PFO[j] = CR[i] - box;
   BarTurn[j] = Bar[i];
   DateTurn[j] = BarDate[i];
   DateEnd[j] = BarDate[i];
   BarEnd[j] = Bar[i];
  }
  else
  {
   if( CR[i] >= PFC[j] + box && up)   //Continue up
   {
    PFC[j] = CR[i];
    PFO[j] = CR[i] - box;
    DateEnd[j] = BarDate[i];
    BarEnd[j] = Bar[i];
   }
   else
   {
    if( CF[i] <= PFC[j] - Reverse && up)   //Change direction to down
    {
     j++;
     up = 0;
     down = 1;
     PFC[j] = CR[i];
     PFO[j] = CR[i] + box;
     BarTurn[j] = Bar[i];
     DateTurn[j] = BarDate[i];
     DateEnd[j] = BarDate[i];
     BarEnd[j] = Bar[i];
    }
   }
  }
 }
}

delta = BarCount-1 - j;

BarTurns = Ref( BarTurn, -delta);
DateTurns = Ref( DateTurn, -delta);
BarEnds = Ref( BarEnd, -delta);
DateEnds = Ref( DateEnd, -delta);

PFO = Ref( PFO, -delta );
PFC = Ref( PFC, -delta );

Rise = PFC>PFO;
Fall = PFC<PFO;

H = IIf( Ref(Rise, -1), Ref( HHV(PFC, 1), -1 ) - 1, Max(PFO, PFC) ) * box +
box/2;
L = IIf( Ref(Fall, -1), Ref( LLV(PFC, 1), -1 ) + 1, Min(PFO, PFC) ) * box -
box/2;
O = IIf( Ref(Rise, -1), Ref( HHV(PFC, 1), -1 ) - 1, IIf( Ref(Fall, -1), Ref(
LLV(PFC, 1), -1 )+ 1, PFO ) ) * box;

// the difference between Open AND Close is set to box size
// the sign decides if X or O are plotted

C = O + box * IIf( Rise, 1, -1 );

Top = H - box/2;
Bot = L + box/2;

Title = Name() + " " + Date() + ": BPI PnF Chart, H: " + top + ", L: " + bot
+ ", Box " + box + ", Reversal " + reverse + ": Number of Stocks = " + V + "
: Number of Bull Signals = " + C;

GraphXSpace=5;

Plot(C, "BPI", IIf( Rise, colorBlue, colorRed ), stylePointAndFigure);

Plot(30-box/2, "", colorGreen, styleLine+styleNoRescale);
Plot(70+box/2, "", colorBrown, styleLine+styleNoRescale);

//--Indicator-End--






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







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/