I have a question regarding the Yahoo data feed and the different values I get if I run my Strategy from a live simulated instance of NT 7 on Amazon, and when I run in Back Test from my PC the same strategy.
Assumption: I am using the standard Yahoo EOD free connections in both cases.
The main code part involved are:
protected override void Initialize()
{
CalculateOnBarClose = true;
TimeInForce = Cbi.TimeInForce.Day;
EntryHandling = EntryHandling.UniqueEntries;
ExitOnClose = false;
TraceOrders = true;
Add("^VIX", PeriodType.Day, 1);
}
protected override void OnBarUpdate()
{
vix=Closes[1][0];
AccountSize = ACCOUNTSIZE;
Print ("Data= "+Time[0].ToString()+
"SPY= Close: "+Closes[0][0]+
" Open: "+Opens[0][0]+
" High: "+Highs[0][0]+
" Low: "+Lows[0][0]+
" RSI(2)= "+RSI(BarsArray[0],2,1)[0].ToString()+
" RSI(4)= "+RSI(BarsArray[0],4,1)[0].ToString());
Print ( " SMA(5)= "+SMA(BarsArray[0], 5)[0].ToString()+
" SMA(200)= "+SMA(BarsArray[0], 200)[0].ToString()+
" VIX= "+vix+
" PL= "+PL+" AccountSize= "+AccountSize+" ACCOUNTSIZE= "+ACCOUNTSIZE+
" Open PnL: " + Position.GetProfitLoss (Close[0], PerformanceUnit.Currency)+
" Bollinger%= "+(((Closes[0][0]- Bollinger(BarsArray[0],2,20).Lower[0])/(Bollinger(BarsArray[0],2,20).Upper[0]- Bollinger(BarsArray[0],2,20).Lower[0]))*100).ToString()+
" Position Quantity= "+Positions[0].Quantity
);
.....
......
}
If I look at the log in the LIVE AMAZON instance, I get this log:
Data= 20/01/2015 22.00.00SPY= Close: 202,06 Open: 201,63 High: 202,65 Low: 200,19 RSI(2)= 70,7877489259826 RSI(4)= 52,6366072990382
SMA(5)= 201,13 SMA(200)= 199,380728476821 VIX= 19,89 PL= 50000 AccountSize= 50000 ACCOUNTSIZE= 50000 Open PnL: 0 Bollinger%= 31,0613879708437 Position Quantity= 243
FINE
Data= 22/01/2015 06.00.00SPY= Close: 203,08 Open: 201,37 High: 203,6 Low: 200,99 RSI(2)= 83,9012895919414 RSI(4)= 61,4028570626754
SMA(5)= 201,33 SMA(200)= 199,405065789474 VIX= 19,89 PL= 50000 AccountSize= 50000 ACCOUNTSIZE= 50000 Open PnL: -806,899999999996 Bollinger%= 41,203801398233 Position Quantity= 243
FINE
Data= 21/01/2015 22.00.00SPY= Close: 203,08 Open: 201,37 High: 203,6 Low: 200,99 RSI(2)= 83,9012895919414 RSI(4)= 61,4028570626754
SMA(5)= 201,33 SMA(200)= 199,405065789474 VIX= 19,04 PL= 50000 AccountSize= 50000 ACCOUNTSIZE= 50000 Open PnL: 0 Bollinger%= 41,203801398233 Position Quantity= 243
FINE
Data= 23/01/2015 06.00.00SPY= Close: 206,1 Open: 203,08 High: 206,23 Low: 202,49 RSI(2)= 95,5993108194033 RSI(4)= 77,6980472893327
SMA(5)= 202,378 SMA(200)= 199,448823529412 VIX= 19,04 PL= 50000 AccountSize= 50000 ACCOUNTSIZE= 50000 Open PnL: -73,0400000000003 Bollinger%= 68,4020441180292 Position Quantity= 243
FINE
Data= 22/01/2015 22.00.00SPY= Close: 206,1 Open: 203,08 High: 206,23 Low: 202,49 RSI(2)= 95,5993108194033 RSI(4)= 77,6980472893327
SMA(5)= 202,378 SMA(200)= 199,448823529412 VIX= 16,64 PL= 50000 AccountSize= 50000 ACCOUNTSIZE= 50000 Open PnL: 0 Bollinger%= 68,4020441180292 Position Quantity= 243
FINE
If i look at the log after a Back test run now on my PC, I get this log:
Data= 20/01/2015 22:00:00SPY= Close: 201,63 Open: 198,77 High: 201,82 Low: 198,55 RSI(2)= 64,7219247914897 RSI(4)= 48,8446518959898
SMA(5)= 201,248 SMA(200)= 196,71965 VIX= 19,89 PL= 30000 AccountSize= 30000 ACCOUNTSIZE= 30000 Open PnL: 0 Bollinger%= 25,2264002405181 Position Quantity= 148
FINE
Data= 21/01/2015 06:00:00SPY= Close: 202,06 Open: 202,4 High: 202,72 Low: 200,17 RSI(2)= 70,7782259970227 RSI(4)= 52,4943843093617
SMA(5)= 201,13 SMA(200)= 196,7868 VIX= 19,89 PL= 30000 AccountSize= 30000 ACCOUNTSIZE= 30000 Open PnL: -304,88 Bollinger%= 30,7949584839221 Position Quantity= 148
FINE
Data= 21/01/2015 22:00:00SPY= Close: 202,06 Open: 202,4 High: 202,72 Low: 200,17 RSI(2)= 70,7782259970227 RSI(4)= 52,4943843093617
SMA(5)= 201,13 SMA(200)= 196,7868 VIX= 18,85 PL= 30000 AccountSize= 30000 ACCOUNTSIZE= 30000 Open PnL: 0 Bollinger%= 30,7949584839221 Position Quantity= 148
FINE
Data= 22/01/2015 06:00:00SPY= Close: 203,08 Open: 201,5 High: 203,66 Low: 200,94 RSI(2)= 83,8949665375662 RSI(4)= 61,2405555577476
SMA(5)= 201,33 SMA(200)= 196,8702 VIX= 18,85 PL= 30000 AccountSize= 30000 ACCOUNTSIZE= 30000 Open PnL: -153,919999999999 Bollinger%= 40,5840958238218 Position Quantity= 148
Data= 23/01/2015 06:00:00SPY= Close: 206,1 Open: 203,99 High: 206,26 Low: 202,33 RSI(2)= 95,5973201940921 RSI(4)= 77,5542572006776
SMA(5)= 202,378 SMA(200)= 196,979 VIX= 16,4 PL= 30000 AccountSize= 30000 ACCOUNTSIZE= 30000 Open PnL: 293,039999999998 Bollinger%= 66,7740170195356 Position Quantity= 148
FINE
Now here are my issues.
- Why I get let's say two series of traces for each day, one marked at 22.00.00 time and the other at 06.00.00 time ? I have this question since many times but now that Iwant to investigate deeplt why there are issues on values and times, I would like to know why there is a double round on the OnBarUpdate main cycle.
- Why for VIX instrument I get different values ? For the day 21/02/2015 22.00.00 I get on AMAZON instance 19,89 and on my PC in BT I get from Yahoo 18,85 ? Please note that the official quote of Yahoo.com now for VIX for the day 21/02/2015 is 18,85 for the CLOSE price, so it is correct what I get now running a back test, but it seems wrong what NT in the live Instance got before.
This is not the first time that I noticed misalignment between the two instance with the same Data Feed. Also for instruments as SPY (ETF) I noticed some misalignments, so this get me crazy. Are there some reasons that justify that from a NT 7 live instance the data from a certain Data feed could be different from a batch request as for a Back Test run ?
Many thanks for you precious support.
Comment