Popup Window: Preventing pile-ups

By Dennis Brown

The popup window is a great tool in debugging and can help you to keep track of what your code is doing or it can be used to alert you to special situations in your normally running formula. A common problem is that if you call PopupWindow() from a loop or if one gets generated on every AFL pass, you can get hundreds or even thousands of pop-ups piling up on your screen. Tomasz posted a simple work-around on the AmiBroker Feedback Center that took care of the problem in some cases (Suggestion 1528):

The following is a more complete version of this solution that adds a popupID to keep track of each individual popup window and re-enable the popup after its specified timeout period, or if any of the displayed text changes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function GetSecondNum()
{
    Time = Now( 4 );
    Seconds = int( Time % 100 );
    Minutes = int( Time / 100 % 100 );
    Hours = int( Time / 10000 % 100 );
    SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
    return SecondNum;
}
 
function PopupWindowEx( popupID, bodytext, captiontext, timeout, left, top )
{
    displayText = bodytext + captiontext;
    if ( ( StaticVarGetText( "prevPopup" + popupID ) != displayText) OR ( StaticVarGet( "prevPopupTime" + popupID ) < GetSecondNum() ) )
    {
        StaticVarSetText( "prevPopup" + popupID, displayText);
        StaticVarSet( "prevPopupTime" + popupID, GetSecondNum() + timeout );
        PopupWindow( bodytext, Captiontext + popupID, timeout, Left, top );
    }
}
 
PopupWindowEx( "ID:1", "testing", "test alert ", 5, -1, -1 );
PopupWindowEx( "ID:2", "testing", "test alert ", 5, 0, 0 );
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Wordpress upgrade

Due to vulnerability found in previous version of Wordpress (2.2) and attack attempts this site experienced and the compatibility issues with Windows Live Writer that surfaced after quick security fix was applied, I was forced to perform upgrade to newest version of Wordpress.
This results in old Table-of-content plugin not working anymore and the need for rewrite. The new version produces ill-formatted output. Please be patient when TOC plugin is under rewrite.

Also note that although read experience does not change (the site looks identical from reader perspective), the author control panel has changed and looks different. It requires some time to adjust to new design, but after a while I think it is better. I am sorry about this mess but it was not caused by me.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Pattern Recognition Across Timeframes

TEMPORARY DRAFT

Two classical bullish patterns in daily bars.

PR001

Timeframe shifted to weekly.

Selector line moved to highlight the former Pivot Lo value.

PR002

Timeframe shifted to Monthly.

Selector line moved to highlight the former Pivot Lo value.

PR003

 

Note that the 2nd and third Pivot Lo’s (not marked on the charts) are not significant in the monthly timeframe i.e. the monthly chart does not truly represent the underlying waves (cycles) of the daily chart (which I claim is the natural rhythm of the market notwithstanding that the intra-day charts tell us as much, if not more, about the behaviour of market participants).

 

Bonus Commentary

Comparing perfect equity with a buy&hold strategy for three weeks (using an earlier section of the above chart).

The charts are linked and in different timeframes.

 

Perfect trades are an approximation of Pivot Hi to Pivot Lo marked in colour with corresponding % change obtained via the AB studies tooltips.

For the sake of the exercise I cheated a little on the perfect swings.

For convenience I ignored inside and outside days (not counted as a swing) -annoying little things those ID’s and OD’s - messing up my perfect theories like that.

 

PR005

 

PR004

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...