PureBytes Links
Trading Reference Links
|
I have written some code which scans a big ticker list (490 tickers), depending on 4 criteria's (Price, Volume, Liquidity and Price Range) ? those passing though will be added to a new Watchlist.
It works fine, except the first time I run the code. Because the first time, both Liquidity and Price Range shows up as {EMPTY} in a _TRACE!!! Second time it works fine.
Here is what makes it even stranger!!! A friend of mine tried the code in his AB installation and it just works fine for him!!!
I am using IQFeed and have done a complete backfill of the all the data.
Here are the parts of the code giving problem:
It starts here:
if ( NewPeriod )
{
ClearWatchList( TickerCategory2, TickerListNum2 );
TickerList = GetCategorySymbols( TickerCategory, TickerListNum );
Updated = False;
for ( i = 0; ( Ticker = StrExtract( TickerList, i ) ) != ""; i++ )
{
SetForeign( Ticker );
Updated = CreateWatchList( Ticker, TickerCategory2, TickerListNum2, Updated );
RestorePriceArrays();
}
AlertIf( Updated, "SOUND C:\\Program Files\\AmiBroker\\Sound Files\\newemail.wav", "Search List Updated", 0, 10 );
RefreshWatchList();
}
Then it goes to the CreateWatchList:
function CreateWatchList( Ticker, TickerCategory, TickerListNum, Updated )
{
PriceCondition = LastValue( Condition1() );
if ( PriceCondition )
{
VolumeCondition = LastValue( Condition2() );
if ( VolumeCondition )
{
LiquidityCondition = LastValue( Condition3() );
if ( LiquidityCondition )
{
_TRACE( Ticker + " Condition 3!" );
PriceRangeCondition = LastValue( Condition4() );
if ( PriceRangeCondition )
{
_TRACE( Ticker + " Condition 4!" );
CategoryAddSymbol( Ticker, TickerCategory, TickerListNum );
Updated = True;
}
}
}
}
return Updated;
}
And the Condition functions are:
function Condition1()
{
Condition = Close >= CloseLow AND Close <= CloseHigh ;
return Condition;
}
function Condition2()
{
DailyVolume = TimeFrameGetPrice( "Volume", inDaily, -1 );
TodayVolume = TimeFrameGetPrice( "Volume", inDaily );
Condition = (DailyVolume >= VolumeValueMin AND DailyVolume <= VolumeValueMax) OR TodayVolume >= VolumeValueMin;
return Condition;
}
function Condition3()
{
Liquidity = MA( Close * Volume, ( ( 6.5 * 3600 ) / Interval() ) * 5 );
Condition = Liquidity >= LiquidityOK;
return Condition;
}
function Condition4()
{
H0 = SelectedValue( TimeFrameGetPrice( "H", inDaily, -1 ) );
L0 = SelectedValue( TimeFrameGetPrice( "L", inDaily, -1 ) );
PriceRange = H0 - L0;
Condition = PriceRange >= PriceRangeOK;
return Condition;
}
I have traced the problem and it's in the Condition 3 and 4 Functions which returns {EMPTY} Values the first time the code runs.
Please, please any idea what can cause this problem in my AB, but not on my friends AB? I can e-mail you the whole code if you have time to take a look?
Thanks!!!
Jorgen
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|