AFL some values are empty, need help please!

I try to scan this, but when Filter=1, a lot of the RSIS values are empty. How come?

Thanks

SetSortColumns( -5 );

— snip
– inproperly formatted code without references to original author removed

@chaser2009 when you post some code, please use the code button to properly format it, but ABOVE ALL check what you are posting since in the above code there are garbage chars that makes the code non-executable. If in your operating system you are using a nonstandard ASCII language, please double check the pasted result to avoid any issues and in case, please, edit manually the code to avoid the extra/unneeded chars.
Ideally, before posting, use the “Prettify Selection” option on your source code to make it more readable.

Moreover, in general, avoid to assign values to predefined AB identifiers like in:

C=EMA(C,1);

C is a price array identifier used by AmiBroker to hold the Close price array. AFL Reference Manual.
A better way is:

CEma =EMA(C,1);

(In the above case no big damage since EMA(C,1) == C) :exploding_head:

By the way, what is that long and complex formula that assigns a value to y1 supposed to do?

I tested the formula you supplied and actually it does not work properly in the exploration using AB 6.10.0 32 bits (I think there is something wrong with the formula that calculates y1).

What version of AmiBroker are you using?

I just reformatted the code, commented out some nonrelevant code for the purpose of testing, cleaned it a bit, and tested in AB 6.27.1 -64 bits) and the exploration seems to work.
I added the columns for all the intermediate arrays to calculate RSIS (y, y1, y2, y3, t3) to see what values they hold (this is a practice very useful to debug some code). Also NZ() all these arrays to see 0 (zero) values instead of empty cells.

Here is the reformatted code, but probably without a different version of AmiBroker, eyou’ll get the same result with missing values in exploration.

// Downloaded From www.WiseStockTrader.com
// RSIS  Overbought/Oversold Indicator 
// Version 1.0
// Last modified: 26-01-2002 by Thomas Zmuck

// Adjustment-Part - (could be parametrized)
rsiPeriod = 5;  // Param("RSI period", 5, 3, 15, 1);
emaPeriod = 2;  // Param("EMA period", 2, 2, 10, 1);
tp = 3;         // Param("Trend period", 3, 2, 10, 1);
A = 2.5;        // Param("A value", 2.5, 1.5, 5, 0.5);


// Formula
P = RSI( rsiPeriod );
y = Sum( Cum( 1 ), tp );
y1 = ( tp * Sum( Cum( 1 ) * P, tp ) - Sum( Cum( 1 ), tp ) * Sum( P, tp ) ) /
       ( tp * Sum( ( Cum( 1 ) * Cum( 1 ) ), tp ) - ( y * y ) ) * Cum( 1 ) + ( MA( P, tp ) -
         MA( Cum( 1 ), tp ) * ( tp * Sum( Cum( 1 ) * P, tp ) -  Sum( Cum( 1 ), tp ) * Sum( P, tp ) ) /
           ( tp * Sum( ( Cum( 1 ) * Cum( 1 ) ), tp ) - ( y * y ) ) );

slope = LinRegSlope( P, tp );
y2 = IIf( slope > 0 AND y1 > HHV( P, 3 ), HHV( P, 3 ),
          IIf( slope < 0 AND y1 < LLV( P, 3 ), LLV( P, 3 ), y1 ) );
y3 = EMA( y2, emaPeriod );

e1 = EMA( P, emaPeriod + 1 );
e2 = EMA( e1, emaPeriod + 1 );
e3 = EMA( e2, emaPeriod + 1 );
e4 = EMA( e3, emaPeriod + 1 );
e5 = EMA( e4, emaPeriod + 1 );
e6 = EMA( e5, emaPeriod + 1 );

c1 = -A * A * A;
c2 = 3 * A * A + 3 * A * A * A;
c3 = -6 * A * A - 3 * A - 3 * A * A * A;
c4 = 1 + 3 * A + A * A * A + 3 * A * A;
t3 = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;

RSIS = ( y3 + t3 ) / 2;
// End Formula


// Graph-Part
Plot( RSIS, "RSIS", colorOrange, styleLine);
// End Graph-Part


// Buy Conditions
// not used, only for testing systems
Cond1 = Ref( RSIS, -1 ) < 20;
Cond2 = Ref( RSIS, -2 ) < 20;
Cond3 = Ref( RSIS, -1 ) < Ref( RSIS, -2 );
Cond4 = Ref( RSIS, -2 ) < Ref( RSIS, -3 );
Cond5 = RSIS > Ref( RSIS, -1 );
Cond6 = (CCI( 30 ) < 100) AND (CCI( 30 ) > -100);

// Buy and Sell Conditions
Buy  = Ref( rsis, -1 ) < 50 AND RSIs > Ref( RSIs, -1 );
Sell = Ref( rsis, -1 ) > 70 AND RSIs < Ref( RSIs, -1 );

Buy  = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );
// End Buy and Sell Conditions

// Title-Part
Title = Name()
        + "     RSIS period = "
        + WriteVal( rsiPeriod, 1 )
        + "     EMA period = " + WriteVal(emaPeriod, 1 )
        + "     TP = " + WriteVal( tp, 1.1 ) 
        + "     A = " + WriteVal( A, 1.1 );
// End Title-Part


// Added part by @Chaser2009
/*
bNumberofbars = BarsSince( Sell ) ;
bCloseOnSell = ValueWhen( Sell , Close );
bPercentChange = ( Close - bCloseOnSell ) / bCloseOnSell * 100;

snumberofbars = BarsSince( Buy ) ;
sCloseOnBuy = ValueWhen( Buy , Close );
sPercentChange = ( Close - sCloseOnBuy ) / sCloseOnBuy * 100;
*/
/////////////////////////////////////////////////////////////////////////////////////////////
// Colorb = IIf( RSIS > Ref( RSIS, -1 ), colorBlue, colorRed );
// Colorbs = IIf( Buy, colorBlue, IIf( Sell, colorRed, colorDefault ) );
// AddColumn( sNumberOfBars, "Dn" , 1.0, colorRed, colorDefault, 60 );
Filter = 1;
AddColumn(C, "Close", 1.2); 
AddColumn(Nz(y), "y", 1.5); 
AddColumn(Nz(y1), "y1", 1.5); 
AddColumn(Nz(y2), "y2", 1.5); 
AddColumn(Nz(y3), "y3", 1.5); 
AddColumn(Nz(t3), "t3", 1.5); 
AddColumn(Nz(RSIS), "RSIS", 3.5);
// AddColumn( bNumberOfBars, "Up", 1.0, colorBlue, colorDefault , 60 );
DB = RSIS - Ref( RSIS, -1 );
AddColumn( DB, "Ch", 1-0, IIf( DB >= 0, colorBrightGreen, colorOrange ), colorBlack , 60 );
1 Like
  1. You need to read FORUM RULES and follow them.

  2. Wisestock trader is garbage site. They have tons of non-working code copied / stolen from various places without respecting copyright. Don’t use that.

  3. You must NOT post code that you did not write yourself without referring to original author and/or the source. RESPECT COPYRIGHTS!!!

I noted that the original author of this (quite old) AFL is Thomas Zmuck who is the guy behind PatternExplorer (an add-on for AmiBroker).
Nice to see that he still develops code after so many years!

Did original poster get the approval from Thomas Zmuck ? No.
The original formula was placed in AFL library that is in the members’ zone back in 2002, later it was apparently modified by Thomas Zmuck.
Did anyone ask me for the approval to copy COPYRIGHTED material available to members only? No.
So why on earth you people think that you can re-publish the formulas freely?

You can’t.

The same happens on WiseStockTrader site over and over again. I wrote original formula in AFL to draw Trendline Between Previous day High and Previous day Low that got later modified by @empottasch in the same thread. That formulas were STOLEN and posted WITHOUT asking original authors:
https://www.wisestocktrader.com/indicators/5665-trend-line-between-previous-days-high-and-low-for-amibroker-afl

All contents of AmiBroker.com site (including forums) is COPYRIGHTED and republishing on other sites is prohibited. Yet, shitty sites like “wisestocktrader” ignore copyrights.

I am using AB 6.27.1 32-bit version, your new AFL doesn’t work too. Let me try 64-bit… Thank you anyway!

I just tested 64-bit, it was same as 32-bit from my 6.27.1 version. It looks if y3 is zero, RSIS must be zero. Not all the stocks are zero, may be 10% of my watchlist have RSIS values only.l