PureBytes Links
Trading Reference Links
|
The following is a derivative of some code that Herman posted this
week. This is just an example of one approach to managing dynamic
window Titles.
This approach allows you to use:
* One (1) generic Composite containing 'Counts' for different
Explores and different metrics
and
* One (1) generic IB AFL with dynamic Titles for display purposes
and
* Many Explores that generate various counts and Titles for use with
the generic IB
Make many different Explorations to count various metrics, changing
the Title stored in the CompositeDescription variable, and then after
each execution, the IB Title dynamically changes to the value written
to the file "afl\\StatCountsTitle.txt"
The Explore:
// -------EXPLORATION--------
// StatCounts - Number of stocks making new highs
// Use IB 'StatCounts - Display Composite' to View results
// Explore w N last days = 1 against desired watchlist
CompositeDescription = "New Highs / Lows";
fh = fopen( "afl\\StatCountsTitle.txt", "w");
if( fh )
{
fputs( CompositeDescription + " ", fh );
}
fclose( fh );
SetOption("NoDefaultColumns",False);
New10DayHigh = H>Ref(H,-10);
CloseUp3 = C>1.03*Ref(C,-1);
VolumeUp = V>Ref(V,-1);
ConditionHigh = New10DayHigh AND CloseUp3 AND VolumeUp;
New10DayLow = L<Ref(L,-10);
CloseDn3 = C< 0.97*Ref(C,-1);
VolumeDn = V<Ref(V,-1);
ConditionLow = New10DayLow AND CloseDn3 AND VolumeDn;
Filter = ConditionHigh OR ConditionLow;
AddToComposite(ConditionHigh,"~StatCounts","H",1|2|4|16);
AddToComposite(ConditionLow,"~StatCounts","L",1|2|4|16);
AddColumn(ROC(H,10),"%10DayHi",1.2);
AddColumn(ROC(V,1),"%Vup",1.2);
AddColumn(ROC(C,1),"%Cup",1.2);
// ----------- END OF EXPLORATION ----------
... AND NOW ... The generic IB AFL with dynamic Title:
// -------IB DISPLAY OF COMPOSITE --------
// StatCounts - IB Display Composite Indicator
fh = fopen( "afl\\StatCountsTitle.txt", "r");
if( fh )
{
CompositeDescription = fgets( fh );
}
fclose( fh );
SetForeign("~StatCounts", True, True);
Title = "~StatCounts Composite - " + CompositeDescription
Plot(H,"H",colorBrightGreen,styleLine | styleThick);
Plot(L,"L",colorRed,styleLine | styleThick);
RestorePriceArrays();
//---------- END OF IB CODE ----------
My "Title =" code was more complex, but I simplified it to avoid line
wrap problems.
Hope this is useful to someone.
Dennis
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
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:
http://docs.yahoo.com/info/terms/
|