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 );