Please vote for this issue: https://www.multicharts.com/pm/viewissu ... no=MC-1585
Our first attempt of implementing spread trading in MC has resulted in this error. When the price is a positive number, trades happen just fine. When the price falls below zero, no trading occurs. Is there a workaround? Or can we update this?
To go even further, spread trading (buy an instrument and sell another) is a popular practice in this industry. There's no public tool (that I know of) that back-tests spreads. If MC implemented a tool for this and publicized it... $$..
Incorrect Backtests on Instruments with Negative Prices [SOLVED]
Incorrect Backtests on Instruments with Negative Prices
- Attachments
-
- Spread issue1.png
- (101.76 KiB) Downloaded 1749 times
Last edited by MAtricks on 31 Jan 2014, edited 1 time in total.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hello MAtricks,
Unfortunately at the moment that is not technically possible to use negative data values for backtesting in MultiCharts.
If you have an idea how to convert negative price on a chart into money value-please feel free to share it with us and it will be discussed with our management.
Unfortunately at the moment that is not technically possible to use negative data values for backtesting in MultiCharts.
If you have an idea how to convert negative price on a chart into money value-please feel free to share it with us and it will be discussed with our management.
Please vote for the corresponding feature request.To go even further, spread trading (buy an instrument and sell another) is a popular practice in this industry. There's no public tool (that I know of) that back-tests spreads. If MC implemented a tool for this and publicized it... $$..
Re: Incorrect Backtests on Instruments with Negative Prices
If you are doing spread trading it is probably better to use the ratio of two instruments rather than their difference. If Stock #1 is $100 and Stock #2 is $50 and their ratio is 2 and their spread is $50. However, if Stock 1 and Stock 2 double their ratio remains 2 while their spread becomes $100. Ratios would solve the problem of negative values.
- PatrickSocal
- Posts: 58
- Joined: 27 Apr 2013
- Location: San Diego, CA
- Has thanked: 23 times
- Been thanked: 30 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hi Henry,
If you have an idea how to convert negative price on a chart into money value-please feel free to share it with us and it will be discussed with our management.
To answer your post... On our broker feed (Rithmic), they list calendar spreads which are quoted and traded as a single symbol. For a made-up example, if you want to go long 10 lots of July contract X (XN14) and short 10 lots of August contract X (XQ14), you can do so by buying 10 lots of July-August spread contract X (XN14-XQ14). If this contract is not already listed, a phone call can get it listed, as long as you have the entitlement to trade the individual legs. From that point forward, you can receive bid/ask/trade data for the calendar spread contract, computed by the broker feed in real-time from the underlying legs (with the caveat I'll mention below), and you can buy a single contract to buy/sell the pair (and vice versa). I just did a quick lookup on Rithmic, and there are over 100,000 of these spread symbols currently listed (see image below).
So from the point of view of the MultiCharts application, this is a real, tradeable instrument, and it can have prices that swing from positive to negative depending on whether the market is in backwardation or contango. And yes, you can buy/sell it even if the spread price is negative.
One caveat regarding the quote data... It seems that Rithmic reports bid/ask derived from the underlying legs, and as such there are frequent quotes. But trades seem to be reported only when they occur on the spread contract, which can be very sparse at times, even if the underlying legs are trading actively. So any strat would probably want to have a Data2 and Data3 for the underlying legs, and compute the synthetic spread as an indicator for signals. In this case, we would want the chart/strat to recalculate when Data2 and/or Data3 update, even if Data1 does not. I don't know if this is a setting in MultiCharts?
(And @quantarb, you are right, this synthetic spread computed from Data2 and Data3 could be ratio, log-ratio, or whatever else seemed to be advantageous. But we still need to implement the position by using a difference spread, delivered to us by the broker feed as described above.)
If there is anyone else out there who is interested in backtesting and trading futures spreads, please have a look at the PM issue I opened, and vote for it if you can: https://www.multicharts.com/pm/viewissu ... no=MC-1585
Thanks!
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hello Patrick,
Thank you for your input, but that does not actually answer my question. We are aware that Rithmic provides spread data. In MultiCharts you can trade 1 symbol from a chart. So the possible real time spread trading mechanisms are to be thought over, and that is a different question.
The case brought by MAtricks is that it is not possible to backtest instruments with negative prices.
Currently for a positive chart price - the chart price is multiplied by the instrument’s big point value to get 1 contact price in the currency of the instrument.
If the same formula is applied to a negative price value – we will get a negative money value, which is not correct.
With price correction, big point value correction must take place. The question is how to correct it properly.
Thank you for your input, but that does not actually answer my question. We are aware that Rithmic provides spread data. In MultiCharts you can trade 1 symbol from a chart. So the possible real time spread trading mechanisms are to be thought over, and that is a different question.
The case brought by MAtricks is that it is not possible to backtest instruments with negative prices.
If you have an idea how to convert negative price on a chart into money value-please feel free to share it with us and it will be discussed with our management.
The question is how to get the money equivalent of the price of 1 traded contract when the price is negative.And yes, you can buy/sell it even if the spread price is negative.
Currently for a positive chart price - the chart price is multiplied by the instrument’s big point value to get 1 contact price in the currency of the instrument.
If the same formula is applied to a negative price value – we will get a negative money value, which is not correct.
With price correction, big point value correction must take place. The question is how to correct it properly.
- PatrickSocal
- Posts: 58
- Joined: 27 Apr 2013
- Location: San Diego, CA
- Has thanked: 23 times
- Been thanked: 30 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hi Henry,
Thanks very much for your attention... I'm happy to help if I can.
I have backtested strategies on instruments with negative price using my own framework. When I have done so, I have looked at things in terms of "cash impact" of each transaction. When I buy a contract with positive price, it has a negative cash impact, because I have to give my cash in return for the contract. Likewise, when I sell a positive-price contract, it has a positive cash impact.
The same thought process works even when the price is negative. Any kind of buy has a -1 applied to it, and any kind of sell has a +1 applied to it. I worked up an example, enumerating all the possibilities... Long/Short, with postive/negative/mixed entry prices, both in winning and losing scenarios. I think it demonstrates that the approach can work:
I'm also including the spreadsheet as an attachment, in case you want to check my formulas.
Thanks again for your help on this issue... this kind of responsive support is one of the main reasons we are using MultiCharts!
Thanks very much for your attention... I'm happy to help if I can.
I have backtested strategies on instruments with negative price using my own framework. When I have done so, I have looked at things in terms of "cash impact" of each transaction. When I buy a contract with positive price, it has a negative cash impact, because I have to give my cash in return for the contract. Likewise, when I sell a positive-price contract, it has a positive cash impact.
The same thought process works even when the price is negative. Any kind of buy has a -1 applied to it, and any kind of sell has a +1 applied to it. I worked up an example, enumerating all the possibilities... Long/Short, with postive/negative/mixed entry prices, both in winning and losing scenarios. I think it demonstrates that the approach can work:
I'm also including the spreadsheet as an attachment, in case you want to check my formulas.
Thanks again for your help on this issue... this kind of responsive support is one of the main reasons we are using MultiCharts!
- Attachments
-
- MultiCharts_NegativePrice_Issue.xls
- Spreadsheet with Positive/Negative price scenarios
- (23 KiB) Downloaded 355 times
-
- MC_NegativePrice_Proposal_Short.png
- Short Trades with Positive/Negative prices
- (43.55 KiB) Downloaded 1681 times
-
- MC_NegativePrice_Proposal_Long.png
- Long Trades with Positive/Negative prices
- (41.19 KiB) Downloaded 1693 times
- PatrickSocal
- Posts: 58
- Joined: 27 Apr 2013
- Location: San Diego, CA
- Has thanked: 23 times
- Been thanked: 30 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hi Henry,
I just re-read your question:
In an intermarket difference spread, there is not a fixed big point value. So the situation is more complicated. To be 100% accurate it requires knowing the price change of each leg, and the big point value of each leg. However, to treat it as a single instrument, the user can approximate it by using a constant number that's close to the average big point value over the backtest period, entering it into the Quote Manager as if it's a constant big point value.
But the original question here is about calendar spreads that can go negative. Those are the easy case, because the big point value is the same, and the arithmetic works the same whether the prices are positive or negative. Does this make sense?
I just re-read your question:
Perhaps I misunderstood your question. In a calendar difference-spread, both the long and short legs of the spread have the same "contract multiplier" or big point value. So the dollar value of a +1 point change is still +1 x big point value, regardless of the sign of the starting and ending values.The question is how to get the money equivalent of the price of 1 traded contract when the price is negative.
Currently for a positive chart price - the chart price is multiplied by the instrument’s big point value to get 1 contact price in the currency of the instrument.
If the same formula is applied to a negative price value – we will get a negative money value, which is not correct.
With price correction, big point value correction must take place. The question is how to correct it properly.
In an intermarket difference spread, there is not a fixed big point value. So the situation is more complicated. To be 100% accurate it requires knowing the price change of each leg, and the big point value of each leg. However, to treat it as a single instrument, the user can approximate it by using a constant number that's close to the average big point value over the backtest period, entering it into the Quote Manager as if it's a constant big point value.
But the original question here is about calendar spreads that can go negative. Those are the easy case, because the big point value is the same, and the arithmetic works the same whether the prices are positive or negative. Does this make sense?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hello PatrickSocal,
Thank you for your feedback. Unfortunately there is no technical possibility for such improvement at the moment. We will definitely keep your suggestion in mind to get back to it when there is a possibility to make MultiCharts better in this field.
Thank you for your feedback. Unfortunately there is no technical possibility for such improvement at the moment. We will definitely keep your suggestion in mind to get back to it when there is a possibility to make MultiCharts better in this field.
-
- Posts: 44
- Joined: 02 Jan 2015
- Has thanked: 1 time
Re: Incorrect Backtests on Instruments with Negative Prices
Hi,
sorry, just a question... i got the same problem, did you fix it?
thanks for your help
Filippo
sorry, just a question... i got the same problem, did you fix it?
thanks for your help
Filippo
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hello Filippo,
That is not possible to use negative data values for backtesting in MultiCharts.
That is not possible to use negative data values for backtesting in MultiCharts.
Re: Incorrect Backtests on Instruments with Negative Prices
Can't MC simply take profit loss as:
(exit price - entry price) *bigpointvalue*contracts
so using a negative May WTI futures contract where I've bought 2 lots of -20 and sold 2 lots of -10:
(-10.00 - -20.00) * 1000 *2 = $20000 profit
I'm guessing I've missed something as that sounds really simple.
(exit price - entry price) *bigpointvalue*contracts
so using a negative May WTI futures contract where I've bought 2 lots of -20 and sold 2 lots of -10:
(-10.00 - -20.00) * 1000 *2 = $20000 profit
I'm guessing I've missed something as that sounds really simple.
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hello wilkinsw,
The support for negative prices is something we are working on at the moment. Please follow our blog to find out about the new releases and the new features implemented in them.
The support for negative prices is something we are working on at the moment. Please follow our blog to find out about the new releases and the new features implemented in them.
Re: Incorrect Backtests on Instruments with Negative Prices
Any updates on this please?
Pretty much all my live back adjusted charts that have energy futures have negative prices before early 2020. It therefore creates false backtest reports.
Pretty much all my live back adjusted charts that have energy futures have negative prices before early 2020. It therefore creates false backtest reports.
- Kate MultiCharts
- Posts: 600
- Joined: 21 Oct 2020
- Has thanked: 10 times
- Been thanked: 150 times
Re: Incorrect Backtests on Instruments with Negative Prices
Hello wilkinsw,Any updates on this please?
Pretty much all my live back adjusted charts that have energy futures have negative prices before early 2020. It therefore creates false backtest reports.
The support for negative prices was implemented in MultiCharts 14 Release 4. Please make sure you're using the latest MultiCharts release, it can be downloaded here.
If there are any issues with negative prices there, please send us the following files for analysis:
- Workspace where the issue is reproduced (with one chart)
- Export of used symbols (with data)
- Exported scripts with all dependent functions that are used in the workspace
- Screenshots demonstrating the issue
- Detailed description and a step-by-step instruction on how to reproduce the issue
Re: Incorrect Backtests on Instruments with Negative Prices [SOLVED]
That's great news, thank you!Hello wilkinsw,Any updates on this please?
Pretty much all my live back adjusted charts that have energy futures have negative prices before early 2020. It therefore creates false backtest reports.
The support for negative prices was implemented in MultiCharts 14 Release 4. Please make sure you're using the latest MultiCharts release, it can be downloaded here.
If there are any issues with negative prices there, please send us the following files for analysis:
- Workspace where the issue is reproduced (with one chart)
- Export of used symbols (with data)
- Exported scripts with all dependent functions that are used in the workspace
- Screenshots demonstrating the issue
- Detailed description and a step-by-step instruction on how to reproduce the issue