Help on Computation Daily Stats on 1-Minute Bar Database

The daily statistic (e.g. standard deviation) doesn't show up on 1-minute to 5-minute charts, but shows up fine on 6-minute or longer. See output, code, and database setting below. Thanks for helping.

/*
	Overnight Return Stats.
 */

procedure SetGapOpenStat( len )
{
    global Chg_ON, Std_chg_ON, Z_chg_ON;
    C_d = TimeFrameCompress( C, inDaily, compressLast );
    O_d = TimeFrameCompress( O, inDaily, compressOpen );
    Chg_ON = ( O_d / Ref( C_d, -1 ) - 1.0 ) * 100.0;
    Std_chg_ON = StDev( chg_ON, len, False );
    Z_chg_ON = ( Chg_ON - MA( Chg_ON, len ) ) / Std_chg_ON;
    Chg_ON = TimeFrameExpand( Chg_ON, inDaily, expandFirst );
    Std_chg_ON = TimeFrameExpand( Std_chg_ON, inDaily, expandFirst );
    Z_chg_ON = TimeFrameExpand( Z_chg_ON, inDaily, expandFirst );
}

len = Param( "Z Len", 150, 50, 300, 50 );
SetGapOpenStat( len ); // set global variables Chg_ON, Std_chg_ON, Z_chg_ON
Plot( Chg_ON, "RetON%", colorBlack, styleNoDraw | styleOwnScale );
Plot( Std_chg_ON, "StdRetON", colorBlack, styleNoDraw | styleOwnScale );
Plot( Z_chg_ON, "Z", colorBlue, styleHistogram );
Plot( 1, "+1", colorGreen, styleLine | styleDashed );
Plot( -1, "-1", colorRed, styleLine | styleDashed );

What you are observing is probably the result of QuickAFL feature.

Please read this article from the Knowledge Base:
http://www.amibroker.com/kb/2008/07/03/quickafl/
that covers what is QuickAFL, how it works, and how to control it.

Yes, that was indeed my problem, Tomasz.

For the benefit of others, I made the following change, replacing

len = Param( "Z Len", 150, 50, 300, 50 );

With

len = Param( "Z Len", 150, 50, 300, 50 );  // Daily bar lookback period
intvl = Interval();
SetBarsRequired( len * inDaily / intvl );