Basis price for Position entry cannot be zero
Author: DartboardTrader
Creation Date: 8/26/2008 4:53 PM
profile picture

DartboardTrader

#1

Before I do any BuyAtMarket(bar,"signal") , I make sure Close[bar] != 0 and Open[Bar] != 0.

I am using some imported futures data (with occasional zeros for Open/Close/High/Low).
For certain listings, I consistently get:

"Basis price for Position entry cannot be zero" in the BuyAtMarket call.

What is the meaning of this error message? How might I work around the issue?

--Mike
profile picture

DartboardTrader

#2
For some background.. the data imported looks like:

Trade Date Futures Open High Low Close Settle Change Total Volume EFP Open Interest
4/18/2008 F (Jan 09) 0 0 0 0 0 0 0 0 0
4/21/2008 F (Jan 09) 0 0 0 0 1 1 0 0 0
4/22/2008 F (Jan 09) 23.92 23.92 23.92 23.92 23.7 22.7 2 0 2
4/23/2008 F (Jan 09) 24.19 24.22 23.7 24.06 23.67 -0.03 70 0 72
4/24/2008 F (Jan 09) 23.99 24.28 23.5 23.99 23.56 -0.11 49 0 121

The below call causes the error described.
BuyAtMarket(2,"signal");

I double checked the data structure in Visual Studio 2005, and the High/Low/Close/Open are all filled in with the values 23.92, as shown above, so why would WL complain about the basis price?

--Mike
profile picture

Eugene

#3
To determine the position size for next trading signal, Wealth-Lab needs some basis price to base its decision upon. For each order type, that price is different. Because the entry price is available only after taking the trade, and for market orders, the entry price is the open price of the bar, Wealth-Lab considers previous bar as the signal bar in this case where you do the BuyAtMarket(2).
profile picture

DartboardTrader

#4
So, if I understand this correctly, BuyAtMarket(2) means the below record is used for the EntryPrice:

4/22/2008 F (Jan 09) 23.92 23.92 23.92 23.92 23.7 22.7 2 0 2

But, WL looks back at a previous bar, in this case being:

4/21/2008 F (Jan 09) 0 0 0 0 1 1 0 0 0

to determine a portfolio-based number of shares to send if it were a real market order?

Correct me if I am wrong.. the issue is that WL needs to guesstimate how many shares to purchase as part of the market order, something I take for granted when I do my own market orders I suppose. :-)

So, to work around this, I need to munge the original data series, find two consecutive days in which Open/Close/High/Low values non-zero, or write a modified BuyAtMarket function?

Is there a way I can set a preference for WL's behavior to peek at the current bar only to perform the basis calculation?
Or is there a way to specify a filter in the data series importer to ignore/drop bars that match a criteria such as zero pricing information?

In the meantime, I rewrote the WL4.5 BuyAtMarket2 in C# to use a BuyAtLimit(bar, Open[bar], signalName) as a workaround. Good enough for backtesting purposes.

CODE:
Please log in to see this code.

profile picture

Eugene

#5
QUOTE:
So, if I understand this correctly, BuyAtMarket(2) means the below record is used for the EntryPrice:

4/22/2008 F (Jan 09) 23.92 23.92 23.92 23.92 23.7 22.7 2 0 2

But, WL looks back at a previous bar, in this case being:

4/21/2008 F (Jan 09) 0 0 0 0 1 1 0 0 0

to determine a portfolio-based number of shares to send if it were a real market order?
Yes.
QUOTE:
Or is there a way to specify a filter in the data series importer to ignore/drop bars that match a criteria such as zero pricing information?
Is a specific data provider on your mind?
profile picture

DartboardTrader

#6
QUOTE:
Is a specific data provider on your mind?


CBOE End of Day Futures Data.
http://cfe.cboe.com/Products/historicalVIX.aspx

It's littered with zero Open/Close/High/Low bars.

And, there are a few lines where they put spaces or empty space instead of zeros (which I had to manually edit, since the WL5.1 Text File Data Source Importer does not offer an option to take empty fields as zeros. Unless I missed it somewhere.) Hint hint. :)

Is this request more suitable for a support ticket?
profile picture

Eugene

#7
QUOTE:
And, there are a few lines where they put spaces or empty space instead of zeros (which I had to manually edit, since the WL5.1 Text File Data Source Importer does not offer an option to take empty fields as zeros.

The ASCII provider is actually capable of handling kinky data (e.g. multiple field separators - undocumented). However this request looks like it deserves a support ticket - you're welcome.