Hi,
I am looking for a way to program powerlanguage in order to only enter one trade per day, when I run the strategy in portfolio backtester, on multiple equities.
Can anyone help?
Thanks a lot
moses
Help! Limiting entries by time
- TJ
- Posts: 7752
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1034 times
- Been thanked: 2228 times
Re: Help! Limiting entries by time
Do you know how to set up a counter?Hi,
I am looking for a way to program powerlanguage in order to only enter one trade per day, when I run the strategy in portfolio backtester, on multiple equities.
Can anyone help?
Thanks a lot
moses
- TJ
- Posts: 7752
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1034 times
- Been thanked: 2228 times
Re: Help! Limiting entries by time
Look upHi,
I am looking for a way to program powerlanguage in order to only enter one trade per day, when I run the strategy in portfolio backtester, on multiple equities.
Can anyone help?
Thanks a lot
moses
Portfolio_CurrentEntries
I haven't tried this myself, but from the description, it might do what you want.
There are more portfolio backtesting information in wiki.
- TJ
- Posts: 7752
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1034 times
- Been thanked: 2228 times
Re: Help! Limiting entries by time
If your current entry = 1, then add to a counter that you have already fulfilled your daily quota, and stop trading.Hi again,
I have not managed to think of a way to do what I need.
Any ideas, anyone?
Thank you
moses
When a new day starts, reset the counter and start again.
Re: Help! Limiting entries by time
Thank you TJ.
I think my puzzle becomes more tricky because of the following:
my strategy is a trend-following strategy that keeps positions open for weeks.
Maybe this is not really important, because I could say to my counter "if you are higher than yesterday's value (meaning that a new trade has been entered into today), don't allow one more new trade today".
However, the Portfolio_CurrentEntries function seems to re-calculate itself only at the end of the day, and only after maybe another 10 positions have been entered during the day..
I hope I am missing something simple to solve this, but any ideas would be very welcome!
Thanks again
moses
I think my puzzle becomes more tricky because of the following:
my strategy is a trend-following strategy that keeps positions open for weeks.
Maybe this is not really important, because I could say to my counter "if you are higher than yesterday's value (meaning that a new trade has been entered into today), don't allow one more new trade today".
However, the Portfolio_CurrentEntries function seems to re-calculate itself only at the end of the day, and only after maybe another 10 positions have been entered during the day..
I hope I am missing something simple to solve this, but any ideas would be very welcome!
Thanks again
moses
Re: Help! Limiting entries by time
You could try something like this.
Code: Select all
// Enable order entry at the start of each new day
if Date <> Date[1] then
begin
OrderEntryEnabled = true;
end;
//
if MarketPosition <> MarketPosition[1] then
begin
OrderEntryEnabled = false;
end;