I know I can use Portfolio_CurrentEntries to determine the number of open positions within a portfolio, but with multiple strategies is there a way to limit the open positions specific to that strategy?
For instance I am backtesting two separate strategies (on multiple instruments) within a portfolio that are inversely correlated and I would like to limit each strategy to just one open position. I have tried using Portfolio_CurrentEntries < 3 , but at times I get two trades in one strategy and none on the other.
Anyway around this in Portfolio Backtester ?
Limiting the number of entries in Portfolio Backtester ? [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Limiting the number of entries in Portfolio Backtester ?
Aston01, unfortunately there is no reserved word to limit the amount of entries per strategy at the moment. This is something that will be added in MultiCharts 9.0.
-
- Posts: 223
- Joined: 16 Oct 2011
- Has thanked: 66 times
- Been thanked: 20 times
Re: Limiting the number of entries in Portfolio Backtester ?
I am aware of "Portfolio_CurrentEntries", but this will not limit the strategy from entering 10 new entries on one day. For example if it goes into the day with less than 3 entries, the strategy may open 10 new positions. So their needs to be a way to limit the number of new entries on one day. Any ideas of a work around?
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: Limiting the number of entries in Portfolio Backtester ?
Hello, waveslider!
I’m afraid we haven’t introduced any keyword for limiting entries.
If you need to limit the number of entries for the day, you can compare the value returned by Portfolio_CurrentEntries with the one you need (10, as in your example), and make so that the entry orders are not generated when the condition Portfolio_CurrentEntries < 10 is not true.
I’m afraid we haven’t introduced any keyword for limiting entries.
If you need to limit the number of entries for the day, you can compare the value returned by Portfolio_CurrentEntries with the one you need (10, as in your example), and make so that the entry orders are not generated when the condition Portfolio_CurrentEntries < 10 is not true.
- ABC
- Posts: 721
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 409 times
- Contact:
Re: Limiting the number of entries in Portfolio Backtester ?
waveslider,
you can accomplish this using a portfolio money management signal and only let the number of entry orders pass that you want to allow.
Regards,
ABC
you can accomplish this using a portfolio money management signal and only let the number of entry orders pass that you want to allow.
Regards,
ABC
I am aware of "Portfolio_CurrentEntries", but this will not limit the strategy from entering 10 new entries on one day. For example if it goes into the day with less than 3 entries, the strategy may open 10 new positions. So their needs to be a way to limit the number of new entries on one day. Any ideas of a work around?
-
- Posts: 223
- Joined: 16 Oct 2011
- Has thanked: 66 times
- Been thanked: 20 times
Re: Limiting the number of entries in Portfolio Backtester ?
Thanks ABC, I thought so too but was unable to do it. Can you give me a clue as to which signal would help?
- ABC
- Posts: 721
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 409 times
- Contact:
Re: Limiting the number of entries in Portfolio Backtester ?
waveslider,
the "Portfolio Rank MM Signal" and documentation should get you going.
Regards,
ABC
the "Portfolio Rank MM Signal" and documentation should get you going.
Regards,
ABC
-
- Posts: 223
- Joined: 16 Oct 2011
- Has thanked: 66 times
- Been thanked: 20 times
-
- Posts: 223
- Joined: 16 Oct 2011
- Has thanked: 66 times
- Been thanked: 20 times
Re: Limiting the number of entries in Portfolio Backtester ?
Still running into issues with this. Here is some code I tried:
Then I say something like :
Still will get multiple entries on the bar. This is because Portfolio trader doesn't know how many entries it has already made on the current date.
How can I track how many entries have been made so far on the current bar?
Code: Select all
variables: inLong(0), inShort(0);
arrays: strategiesLong[](-1), strategiesShort[](-1);
inLong = pmms_strategies_in_long_count(strategiesLong);
inShort = pmms_strategies_in_short_count(strategiesShort);
Code: Select all
if inlong+inshort<3 then buy this bar;
How can I track how many entries have been made so far on the current bar?
- ABC
- Posts: 721
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 409 times
- Contact:
Re: Limiting the number of entries in Portfolio Backtester ?
waveslider,
from your code snippet it appears you are trying to control the number of entries in the entry strategy. This will most likely not work, as too many entries on different symbols at the same time could go beyond your position limits. Take a look at how the build in "Portfolio Rank MM Signal" only allows entries for the remaining available spots. You would have to take a similar approach and control the entries within a Money Management signal.
Regards,
ABC
from your code snippet it appears you are trying to control the number of entries in the entry strategy. This will most likely not work, as too many entries on different symbols at the same time could go beyond your position limits. Take a look at how the build in "Portfolio Rank MM Signal" only allows entries for the remaining available spots. You would have to take a similar approach and control the entries within a Money Management signal.
Regards,
ABC