Is an IOG enabled code back-testable? If yes, How?
- TJ
- Posts: 7752
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1034 times
- Been thanked: 2228 times
Thanks TJ!
1) But I can't select "Extended" strategy backtesting when using "MultiCharts Portfolio Backtester" ..... where can I set it?
2) Well, I want to test an IOG enabled strategy on a ticker with 5-min timeframe. It appears to me that the database should have the bid/ask data series on top of the trade data series. BUT, my data was imported with the trade data series. Does it mean that there is no way to test it?
3) The reason why I initiated this thread is because it was by the TSSupport that there is a bug in trading with the built-in "Percent Trailing" when using MC6.0 Beta2 or prevous versions, in which it has used the SetPercentTrailing.
I have tested it in realtime with IB's paper trading account, the chart did plot the exit using the right calculation of SetPercentTrailing, but MC didn't seem sending the trailing stop order to IB. So there is a situation that the chart plotting an exit with the position is still in IB's TWS.
I don't want to trade with the beta version (MC 6.0 Beta4 or 3) as it appears to be risky my money to learn some potential but unknown bugs or program instability.
I only solution is to wait for the offical version or do it my way.
4) So I code the concept of SetPercentTrailing using an IOG enabled code to do the job. I have added a 'trigger level' ("PST" in the following code, Protective Stop Trigger) to initiate the Trailing Stop.
I haven't tested it in realtime, but I would think of the following potential problem:
Potential Problem: If the price exceeds the PST level, and keeps on breaking the new highs / lows every tick, I will presume MC will change the Trailing Stop order every tick. Does it mean that the maximum number of changes of order is 60 per second?? (If anyone is familiar with this, please correct me if I am wrong!!)
Does IB "refuse" the user to change the order if it exceed a certain number of order say per 1 min? I can't find it in IB's site.
The second thing is to backtested the strategy, but it doesn't seem right in comparison of the results applying the built in code using SetPercentTrailing as I use the data with trade data series only, and I use Portfolio Backtester in which I can't find any "Extended" strategy backtesting option to be selected. Even with this option, my data is with trade data series only. I am not sure if it is difference is due to the lack of accurate bid / ask data for testing.
Hope any of the experts can help me!!
1) But I can't select "Extended" strategy backtesting when using "MultiCharts Portfolio Backtester" ..... where can I set it?
2) Well, I want to test an IOG enabled strategy on a ticker with 5-min timeframe. It appears to me that the database should have the bid/ask data series on top of the trade data series. BUT, my data was imported with the trade data series. Does it mean that there is no way to test it?
3) The reason why I initiated this thread is because it was by the TSSupport that there is a bug in trading with the built-in "Percent Trailing" when using MC6.0 Beta2 or prevous versions, in which it has used the SetPercentTrailing.
I have tested it in realtime with IB's paper trading account, the chart did plot the exit using the right calculation of SetPercentTrailing, but MC didn't seem sending the trailing stop order to IB. So there is a situation that the chart plotting an exit with the position is still in IB's TWS.
I don't want to trade with the beta version (MC 6.0 Beta4 or 3) as it appears to be risky my money to learn some potential but unknown bugs or program instability.
I only solution is to wait for the offical version or do it my way.
4) So I code the concept of SetPercentTrailing using an IOG enabled code to do the job. I have added a 'trigger level' ("PST" in the following code, Protective Stop Trigger) to initiate the Trailing Stop.
It matches almost 100% as the built-in code, SetPercentTrailing, when applying to a short period of data.{PST then %Trailing}
[IntrabarOrderGeneration = true]
inputs: PST(300),PctTrailing(10);
variables: MP(0),MCP(0),BSE(0),HH(0),LL(0),EP(0),BStop(0),SStop(0);
MP = MarketPosition ;
MCP = MaxContractProfit/bigpointvalue;
BSE=BarsSinceEntry;
HH=Highest(H,BSE);
LL=Lowest(L,BSE);
EP=entryprice;
BStop=HH-(HH-EP)*PctTrailing/100;
SStop=LL+(EP-LL)*PctTrailing/100;
If MP=1 and MCP>PST then sell ("%T-LX") next bar at BStop Stop;
If MP=-1 and MCP>PST then buy to cover ("%T-SX") next bar at SStop Stop;
I haven't tested it in realtime, but I would think of the following potential problem:
Potential Problem: If the price exceeds the PST level, and keeps on breaking the new highs / lows every tick, I will presume MC will change the Trailing Stop order every tick. Does it mean that the maximum number of changes of order is 60 per second?? (If anyone is familiar with this, please correct me if I am wrong!!)
Does IB "refuse" the user to change the order if it exceed a certain number of order say per 1 min? I can't find it in IB's site.
The second thing is to backtested the strategy, but it doesn't seem right in comparison of the results applying the built in code using SetPercentTrailing as I use the data with trade data series only, and I use Portfolio Backtester in which I can't find any "Extended" strategy backtesting option to be selected. Even with this option, my data is with trade data series only. I am not sure if it is difference is due to the lack of accurate bid / ask data for testing.
Hope any of the experts can help me!!
- TJ
- Posts: 7752
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1034 times
- Been thanked: 2228 times
Thanks TJ!
1) But I can't select "Extended" strategy backtesting when using "MultiCharts Portfolio Backtester" ..... where can I set it?
...
see this thread for answer:
http://forum.tssupport.com/viewtopic.php?t=7497
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Dear Spaceant,
1) There is no Extended backtesting in Portfolio Backtester for the moment. However, we plan to add it in the future.
2) IOG means that the strategy is calculated on evey tick. There is no need for bid/ask data series, trades are enough.
3) The SetPercentTrailing bug was fixed in Beta 4 version.
4)
1) There is no Extended backtesting in Portfolio Backtester for the moment. However, we plan to add it in the future.
2) IOG means that the strategy is calculated on evey tick. There is no need for bid/ask data series, trades are enough.
3) The SetPercentTrailing bug was fixed in Beta 4 version.
4)
Yes, you are right, MC will change the Trailing Stop order every tick, if the price exceeds the PST level, and keeps on breaking the new highs / lows every tick. But it does not mean that the maximum number of changes of order is 60 per second. It depends on how many ticks comes every second (maybe 100, may be 0).Potential Problem: If the price exceeds the PST level, and keeps on breaking the new highs / lows every tick, I will presume MC will change the Trailing Stop order every tick. Does it mean that the maximum number of changes of order is 60 per second?? (If anyone is familiar with this, please correct me if I am wrong!!)
Please contact IB with this question.Does IB "refuse" the user to change the order if it exceed a certain number of order say per 1 min? I can't find it in IB's site.
Could you please precise the question?The second thing is to backtested the strategy, but it doesn't seem right in comparison of the results applying the built in code using SetPercentTrailing as I use the data with trade data series only, and I use Portfolio Backtester in which I can't find any "Extended" strategy backtesting option to be selected. Even with this option, my data is with trade data series only. I am not sure if it is difference is due to the lack of accurate bid / ask data for testing.
Dave,Yes, you are right, MC will change the Trailing Stop order every tick, if the price exceeds the PST level, and keeps on breaking the new highs / lows every tick. But it does not mean that the maximum number of changes of order is 60 per second. It depends on how many ticks comes every second (maybe 100, may be 0).
Will MC do anything if price exceeds PST and the new tick does not exceed new high / low? .... the reason why I ask it as in IOG mode, MC will treat every tick as a new bar, so MC will, as I think, canceal the previous trailing stop order, then place a new 'trailing stop order' with the SAME price (as no new high / low). Am I right?
If this is right, with the above code, MC will be very busy with every tick cancealing old trailing stop order and updating a new one....... will that be an issue for MC or IB?
I am just just wondering how the SetPercentTrailing handles the trailing stop order......
Hi Dave,
On top of the two questions in the previous post, I would like to know that following:
On top of the two questions in the previous post, I would like to know that following:
Do I need to check the box to "Use Bar Magnigier (1 tick)", under Backtesting Precision of Backtesting, when I trade the standard / pre-installed SetPercentTrailing or my code?2) IOG means that the strategy is calculated on evey tick. There is no need for bid/ask data series, trades are enough.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Will MC do anything if price exceeds PST and the new tick does not exceed new high / low? .... the reason why I ask it as in IOG mode, MC will treat every tick as a new bar, so MC will, as I think, canceal the previous trailing stop order, then place a new 'trailing stop order' with the SAME price (as no new high / low). Am I right?
Dear Spaceant,Do I need to check the box to "Use Bar Magnigier (1 tick)", under Backtesting Precision of Backtesting, when I trade the standard / pre-installed SetPercentTrailing or my code?
If the price orders do not change on the next tick (the number of orders, number of contracts, direction and price are the same), then the orders are not cancelled, they stay.
As to Bar Magnigier, it works only for history, it is not needed for real-time.
This is the message just received from IB:
I a wondering whether the standard SetPercentTrailing will change the trailing order as frequently as my code does!!??
Does anyone use SetPercentTrailing to trade, please comment!
I was using my Trailing Stop code as posted earlier, as I don't want to use MC6.0 Beta 4 to trade.NOTICE OF HIGH ORDER RATIO
Dear Trader,
We have noticed a very high ratio of orders and order modifications relative to the number of executions in your account XXXXXXX. Every order instruction submitted by you (includes new order submission, order modification, cancellation) utilizes computing power. Excessive order activity can slow down IB systems and negatively impact other clients.
IB monitors order/trade ratios to prevent excessive and unnecessary system resource utilization. As a general rule, a ratio value less than 10 order actions per 1 execution will generally be acceptable, although fees may apply for certain markets where the ratios exceed 5:1. Above 20:1, IB will request clients using automated order management tools to optimize their order management behavior. Above 100 orders per execution, or if our analysis indicates a systematic misuse of IB's automation services, IB may take steps to reduce the system utilization including: charging a fee for order modifications (typically 20% of the commission for an execution), or limiting access to API services.
Most of the time, excessive order/trade ratios are caused by poorly optimized APIs or other order creation programs. These applications generate price changes that do not materially alter the likelihood of the order being filled. By example, when a stock is quoted 50.0-50.2, then an order change from 45 to 46 does not really change the likelihood of execution.
Most clients are able to easily improve their order management by introducing "no-waste" logic into their systems. We kindly request you examine your order management logic to reduce unnecessary orders to the recommended levels. Statistics for the recent observations are:
Ratio: 21.38
Number of New Order Submissions: 142
Number of Order Modifications: 0
Number of Order Cancellations: 136
Number of Executions: 12
For additional information, including suggestions as to how to reduce waste in your order management behavior, please type KB1343 http://ibkb.interactivebrokers.com/node/1343 into the search engine located on the IB home page or contact our API services group at api@interactivebrokers.com
I a wondering whether the standard SetPercentTrailing will change the trailing order as frequently as my code does!!??
Does anyone use SetPercentTrailing to trade, please comment!