- ago
Hello

I have created a custom extensions library containing broker, data provider, strategies etc.

When I ran a coded strategy, I do not understand the profit values/percents shown in the backtest results. This only happens with Options and not with Stocks



The difference between entry and exit is around 320. The quantity is 125 which should result in a profit value of 40043.75 where as the value shown in the UI is 1000x of this value.

Why are these values multiplied by 1000? What is the basis for the calculation?
0
144
Solved
12 Answers

Reply

Bookmark

Sort
Cone7
- ago
#1
Generally and by default, Wealth-Lab assumes that 1 option contract controls 100 shares of the underlying. This is a good assumption for U.S. Options, but maybe not for non-U.S/Euro contracts. So, for a 1-point gain, a single contract gains $100.
Nonetheless, with that assumption, the profit should be 10x less than what's indicated in the image.

1. How have you defined this symbol in Markets & Symbols?
2. Even if "100-share of the underlying" is wrong, you could treat this as a futures contract and enter a Point Value to arrive at the correct result.
0
Best Answer
- ago
#2
I believe this is similar to what happens with futures. I really like Wealth-Lab; but, the way it displays the P/L calculations for leverage markets, is really annoying for me personally.

In another thread, I described my pint of view. Eventually, it turned out into a change request but, to my surprise, it didn’t garner much support: either there are no other futures traders out there (apparently options too), or then I’m the only one that really cannot adapt to this calculation approach.

Just for reference, this is the thread:
https://www.wealth-lab.com/Discussion/Percentage-calculations-for-futures-trading-7514

If you find it is related and would also like to change this, please vote for it. Eventually if we then get a bit more support, perhaps we could have it at least configurable.

Thank you!
0
Cone7
- ago
#3
Percentage aside, how did the $ profit for that trade hit $40M when it should have been $4M? That's a problem with the info entered in Markets and Symbols, right?
0
- ago
#4
The default value for the PointValue property in SymbolInfo class is 1000. I fixed my issue by explicitly setting it to 1 while returning the Bar History object in my Data Provider (in GetHistoryInternal method).
0
- ago
#5
The point value set in the Data provider is not somehow propagated to my strategy code. How can the point value be set so that all instances of BarHistory for a symbol will use the specified point value instead of the default value 1000?
0
Cone7
- ago
#6
QUOTE:
The default value for the PointValue property in SymbolInfo class is 1000
First, there is no "default" value of 1000. The default point value is $1 per point per share/contract. If you enter a point value, that's an override, not a default. For clarity we both must use the same terminology.

QUOTE:
The point value set in the Data provider is not somehow propagated to my strategy code.
Can you explain what you mean, exactly? Because everything that you've shown indicates that the point value used is 1000.

You can use this snippet to demonstrate your case:
CODE:
public override void Initialize(BarHistory bars) {          WriteToDebugLog("Point Value for " + bars.Symbol + " is: " + bars.SymbolInfo.PointValue); }
0
- ago
#7
Hello Cone,

I have implemented my own Broker, Data, and Strategy extensions for Indian Market. Here is the logic I implemented

1. A static initializer method that will be executed before any extension class is instantiated. This method sets up the markets required for India.
2. I am creating and assigning a Symbol info object to BarHistory in the GetHistoryInternal method in my data provider.

Since the bars being returned in GetHistoryInternal method has the SymbolInfo properly assigned and initialized for my market (PointValue = 1), I expected this same SymbolInfo to be present on my Strategy extensions as well (in bars parameter of Initialize and Execute methods). But the bars.SymbolInfo in the Strategy Initialize and Execute methods always has PointValue set to 1000. Currently, I am handling this issue by re-assigning proper values to the SymbolInfo, which I want to avoid.
0
Cone7
- ago
#8
Go to Tools > Markets and Symbols > Symbols tab. Look at the Point Value column.

Do you see a 1000 there?
If so, what's the Symbol for that or those records?

If that doesn't turn up something, go to Preferences > Backtest > Other Settings > Futures Mode. If Futures Mode is checked, uncheck it. Does it make a difference?
0
- ago
#9
My symbols do not show up in the Symbols tab. That is what I was asking - how do I implement my extensions so that my symbols show up there using extension code (programmatic)? Or is the only way to add my symbols is to manually add them to the Symbols.txt?
0
- ago
#10
QUOTE:
Or is the only way to add my symbols is to manually add them to the Symbols.txt?

Yes.
0
- ago
#11
Thanks Eugene. Will do that way.
0
Cone7
- ago
#12
Wait a minute. You don't need to add symbols to Symbols.txt, especially if your provider is returning the correct SymbolInfo with the BarHistory. (Also, you do not need to edit that file directly. Instead add what's required using the Symbols U.I.)

I'm looking for the reason that is "wrong". It could be that that you're using wildcards in [Markets &] Symbols that is matching symbols that have SymbolInfo with a 1000 point value. Did you try turning off Futures Mode? What was the result?
0

Reply

Bookmark

Sort