Basis price for Position entry cannot be zero (Error message)
Author: Ben_Zurich
Creation Date: 8/22/2012 8:03 AM
profile picture

Ben_Zurich

#1
Recently I had the error message

QUOTE:
Basis price for Position entry cannot be zero


which appeared while executing statements such as

CODE:
Please log in to see this code.

CODE:
Please log in to see this code.


When trading Future Spreads you have the situation where prices can be positive, zero or negative. It seems that WL6 allows to trade bars with negative pricing, but not those with a price of zero (i.e. when
CODE:
Please log in to see this code.
).

As a circumvention, I have preceeded above statements by

CODE:
Please log in to see this code.


and back again after the market order.
profile picture

Eugene

#2
The error message is pretty self-descriptive: position sizing can not be done and so the program halts. It is simply impossible to calculate the position size if the current price is zero.
profile picture

Eugene

#3
For more information on the subject, please re-read this User Guide chapter:

Strategy Window > Backtesting Strategies > 100% of Equity Sizing > Basis Price
profile picture

Ben_Zurich

#4
I see. Is there a possibility to use the margin requirement of the Base symbol as a means for automatic position sizing?
profile picture

Cone

#5
QUOTE:
use the margin requirement of the Base symbol as a means for automatic position sizing?
For sure futures margin is used in position sizing, but what do you mean by "automatic"?

It's true that generally you can create trades for instruments with negative pricing, but some (many?) performance metric calculation do not take this into account. For this reason we've always said that negative pricing is not supported.
profile picture

Eugene

#6
profile picture

Ben_Zurich

#7
Thank you, but neither of these posts refer to position sizing (They refer to peeking and other problems).

I will now try to use the WealthScript Override (SetShareSize) in the case of spread trading simulation.
profile picture

Cone

#8
I still don't know what you mean about auto position sizing, but if you're going to use SetShareSize, the SymbolInfo object will come in handy.

CODE:
Please log in to see this code.
profile picture

Ben_Zurich

#9
By that I mean nothing else as what WL6 does all the time: automatically size the position for trades according to the chosen position size option.

In case of spreads (and futures also), in my case, position sizing is a combination of maximum risk to be taken per trade and either margin requirements, or, if known, expected maximum drawdown. The latter can be obtained by such websites as
http://www.mrci.com
http://www.scarrtrading.com
http://www.seasonalfuturescharts.com