Trying to Backtest with IQFeed Intraday Data

I just got the intraday data from IQFeed and am trying to backtest a simple program, but it's not working right so I must be not understanding something and doing something wrong.

The IQFeed is set up and working. I.e, I can actually see intraday data in the graphs.

Like I said, I want to backtest some simple algorithms with Buy signals based upon time.

So far, nothing is working. Even if I do an explore and do something like

AddColumn( TimeNum(), "TimeNum()", 1 );

The only thing that shows in that column is 000000 - so I have no idea what I am doing incorrectly

Any help and direction would be great. Below is the code...


maxpos =  50; // maximum number of open positions
SetOption("InitialEquity", 50000 ); // set initial equity = 50K
SetOption( "MaxOpenPositions", maxpos );
SetPositionSize( 5.0, spsPercentOfEquity );
//SetPositionSize( PosSize, spsValue ); 

StopLossPct =  8.0;

SetTradeDelays( 0, 0, 0, 0 );
SetOption( "ActivateStopsImmediately", True );

BuyPrice  = Open;
 
Stocks = 

       C > 0

   AND Ref( C, -1 ) > MA( Ref( C, -2 ), 20 ) 
   AND Ref( C, -1 ) > MA( Ref( C, -2 ), 50 )  
   AND Ref( C, -1 ) > MA( Ref( C, -2 ), 200 ) 
            
   AND TimeNum() >= 094000
         
   AND Ref( O, -1 ) >= 2.0 
      
   AND MA( Ref( V, -1 ), 20 ) > 200000;

Buy  = Ref( Stocks, -0 );

Short = 0;
Cover = 0;

ApplyStop( stopTypeLoss,  stopModePercent, StopLossPct, 1 );
ApplyStop( stopTypeNBar, stopModeBars, 0, ExitAtStop = 0 );

If exploration's timenum column shows 0 then you are apparently in Daily TF in analysis too. Just few days ago another guy with similar issue.

Old story, BTW.

Also in your entry rule you have "AND TimeNum() >= 094000". This is further indication that you seem to be in wrong time frame in analysis if there is empty result list (besides possible other issues).

2 Likes

Thanks...that helped...

Another issue is that when I run backtest, only a few symbols show up in the Analysis tab...

The IQFeed dialog says its busy "Backfilling" 3000+ queued symbols. "History arrived XXXX" So I assume that there is not enough "backfilled" data - is this right?

So, what does this mean? Does this have to "Backfill" every day? Or does it store this info somewhere in a database on my computer so I don't have to go through this every day?

Then the other symbols are apparently empty and have no price data yet. So if you need more symbols with actual price data then you need to backfill first.


But:

There are subscription limits!

500 simultaneous symbols †† can be watched with basic subscription (up to 2500 at a time available for an additional fee)

So check your subscription limit. Keep staying within that limit!


If you have Local data storage -> enabled in File - Database settings then the backfilled data is stored in AB database. Also it is recommended to do initial backfill (via scan) before market open -> backfills are usually faster outside market hours. Then after initial scan those symbols are getting auto-updated further on (if new data arrives) -> They (the symbols within subscription limit) are subscribed to get further real-time updates.

Also read about "Wait for backfill" option here AmiBroker Knowledge Base » How to backfill all symbols in RT database

As simple backfill 'Scan' code:

SetSortColumns( 3 );
Buy = 1;

If you keep AB closed for hours/days/months/years... and you need new data after re-opening it then obviously you have to backfill again. AB plugin adds data that is missing since last available stored bar of symbol in AmiBroker DB.

1 Like

Things are working much better now - BUT now - it appears that only Aug 13 - Aug 15 have been backfilled by the system - I've followed the directions here: http://www.amibroker.com/guide/h_rtsource.html#WAITFORBACKFILL and your comments above to no avail.

I'd like to have intraday data for a month or so - I am unclear what I am doing wrong at this point

There already is IQFeed tutorial including video in the docs. Just increase number of bars to load in database settings. Apparently it is set too low on your end.
http://www.amibroker.com/iqfeed.html

Ok - I've done all this and watched the video
I still only have 3 days

I've increased the data to pull 200,000 bars instead of 100,000

I am tracking about 220 symbols

On the IQFeed plug-in, it says "History has arrived", but no new data if I change the dates...

It also says: "RT watches free 499" - I'm not sure what that means