backtest buying power limitation help

Questions about MultiCharts and user contributed studies.
treksis
Posts: 13
Joined: 18 Jul 2014
Has thanked: 4 times

backtest buying power limitation help

Postby treksis » 27 Jul 2014

I set up 50000$ as initial capital on the backtester but the backtester exceeds my buying power/cash limit that I have in disposal.
How can I make the code so that I won't buy when I don't have enough available money to buy?

I've found "GetRTDayTradingBuyingPower" but this one does not seem to be working. The powerlanguage editor doesn't even recognizes it and I get "is not recognized" error when I complile.

I also found Getnumpositions (getaccountID), and powerlanguage editor compiled it but it won't work either. I have a maximum buying power of 50k and each position is worth 10k ,so I though if my number of positions is less than 5, than it should buy and if it becomes more than 5 than it shouldn't buy or short since I have no available cap.
I backtested after I added the condition below, backtester kept exceeding the limit.

Does this work only in the real time autotrading situation, and not on the backtest?

Code: Select all

Value1 = GetNumPositions (GetAccountID);
if value1 < 5 then
buy this bar on close;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: backtest buying power limitation help

Postby Henry MultiСharts » 28 Jul 2014

Hello treksis,

There is no prebuilt "GetRTDayTradingBuyingPower" reserved word/function in MultiCharts.
GetNumPositions works only in realtime with auto trading turned on.

Please attach a screenshot of the Portfolio Settings tab with your configuration.


Return to “MultiCharts”