Help! Limiting entries by time

Questions about MultiCharts and user contributed studies.
moses
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

Help! Limiting entries by time

Postby moses » 15 Feb 2013

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

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Help! Limiting entries by time

Postby TJ » 15 Feb 2013

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
Do you know how to set up a counter?

moses
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

Re: Help! Limiting entries by time

Postby moses » 16 Feb 2013

Like a 'for' counter? Yes!

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Help! Limiting entries by time

Postby TJ » 16 Feb 2013

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
Look up

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.

moses
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

Re: Help! Limiting entries by time

Postby moses » 03 Mar 2013

Hi again,

I have not managed to think of a way to do what I need.
Any ideas, anyone?

Thank you
moses

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Help! Limiting entries by time

Postby TJ » 03 Mar 2013

Hi again,

I have not managed to think of a way to do what I need.
Any ideas, anyone?

Thank you
moses
If your current entry = 1, then add to a counter that you have already fulfilled your daily quota, and stop trading.
When a new day starts, reset the counter and start again.

moses
Posts: 54
Joined: 16 Nov 2012
Has thanked: 34 times
Been thanked: 7 times

Re: Help! Limiting entries by time

Postby moses » 03 Mar 2013

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

quantarb
Posts: 51
Joined: 14 Apr 2012
Has thanked: 9 times
Been thanked: 33 times

Re: Help! Limiting entries by time

Postby quantarb » 04 Mar 2013

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;



Return to “MultiCharts”