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

Re: [amibroker] Re: Help *counting* candle patterns



PureBytes Links

Trading Reference Links

>(Quite some time ago I tried to convince TJ to offer a new
>variable type that persisted for the life of each "RUN" and then reset
>, but TJ did not see the need.)

???
 
How about AddToComposite ????
It is doing exactly that - it allows to calculate cumulative statistics accross the list of securities
 
If you are after SINGLE values (numbers) it is also possible via StaticVariables:
 
if( Status("StockNum") == 0 ) StaticVarSet("yourvariable", 0 ); // set to zero at start
 
StaticVarSet("yourvariable",   somecalculation + StaticVarGet("yourvariable") );
 

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: Phsst
Sent: Wednesday, May 31, 2006 3:37 AM
Subject: [amibroker] Re: Help *counting* candle patterns

>>For example obtain a count of the number of engulfing patterns found
for that day over all stocks in my list:>>

Spend a little time looking at this example of gathering stats for an
entire watchlist in an Explore and you should be able to adapt it to
your needs. (Quite some time ago I tried to convince TJ to offer a new
variable type that persisted for the life of each "RUN" and then reset
, but TJ did not see the need.)

//GapStats for a specific Watchlist
// Remember to run against a SINGLE security to avoid iterations
against the same watchlist.
ListCount = 0; // Global Variable
GapUp2Pct = 0;
GapFilled = 0;
ClosedLower = 0;
function GapScanforWatchList( listnum )
{
list = GetCategorySymbols( categoryWatchlist, listnum );
  Average = 0; // Local Variable to function
  for( i = 0; ( sym = StrExtract( list, i ) ) != ""; i++ )
  {
    ListCount++;
    SetForeign(sym, fixup = True);
    LocCondGap = O >= Ref(H, -1) * 1.02;
    LocGapUp2Pct = Cum(LocCondGap);
    GapUp2Pct = GapUp2Pct + LocGapUp2Pct;                // Update Global
    LocCondFillGap = LocCondGap AND  L <= Ref(H, -1);
    LocGapFilled = Cum(LocCondFillGap);
    GapFilled = GapFilled + LocGapFilled;                        //
Update Global
    LocCondClosedLower = LocCondGap AND C < O;
    LocClosedLower = Cum(LocCondClosedLower);
    ClosedLower = ClosedLower + LocClosedLower;          // Update Global
  }
  return Average / i;
}
GapScanforWatchList( 23 );
PctFilled = GapFilled / GapUp2Pct * 100;
PctLower = ClosedLower / GapUp2Pct * 100;
lastbar = BarIndex() == BarCount - 1;

Filter = lastbar;
AddColumn(Listcount,"ListCount",1.0);
AddColumn(GapUp2Pct,"# 2% UpGaps", 1.0);
AddColumn(GapFilled,"# Filled",1.0);
AddColumn(PctFilled,"% Filled", 1.2);

AddColumn(ClosedLower,"# Lower",1.0);
AddColumn(PctLower,"% Lower", 1.2);





Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS