Code for Compounding and Mangement Fees

Questions about MultiCharts and user contributed studies.
JayMTF
Posts: 10
Joined: 13 Dec 2014
Has thanked: 6 times

Code for Compounding and Mangement Fees

Postby JayMTF » 13 Dec 2014

Hello,

I've backtested a strategy that has returned 200% profits since January 2013 to today using a continuous contract with the IB data feed. However, after searching for code or built in features, I have two questions so that the results are more realistic to potential investors:

1) How can I add a management performance fee of 20% of profits high water mark at the end of each month?

2) How can I code or enable compounding so that the system automatically buys/sells 1 ES contract for every $7,500 USD as opposed of using 1 contract regardless of what the account grows to?

Thanks in advance,

Jason

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Code for Compounding and Mangement Fees

Postby JoshM » 14 Dec 2014

Untested but to get you started:

For (1), something like:

Code: Select all

Variables:
highWaterMark(0),
prevHighWaterMark(InitialCapital),
profitThisMonth(0);

if (Month(Date) <> Month(Date[1])) and (BarStatus(1) = 0) then begin

highWaterMark = InitialCapital + NetProfit; // + OpenPositionProfit ?

if (highWaterMark > prevHighWaterMark) then
profitThisMonth = (highWaterMark - prevHighWaterMark) * 0.20;

prevHighWaterMark = MaxList(highWaterMark, prevHighWaterMark);

end;
For (2), something like:

Code: Select all

Variables:
posSize(0),
accountSize(0),
myEntryCondition(true);

if (myEntryCondition = true) then begin

accountSize = InitialCapital + NetProfit; // + OpenPositionProfit?

posSize = Floor(accountSize / 7500);

end;

JayMTF
Posts: 10
Joined: 13 Dec 2014
Has thanked: 6 times

Re: Code for Compounding and Mangement Fees

Postby JayMTF » 15 Dec 2014

Thank you very much JoshM. I would have never been able to figure that out. My code is only 4 lines. I'll give it a try this week and let you know how it goes.

Truly appreciated,

Jason


Return to “MultiCharts”