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

[amibroker] Re: Help *counting* candle patterns



PureBytes Links

Trading Reference Links

>>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);





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

 
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/