Hi to all,
with this code:
value2=(100000)/c;
if date=1020313 {13/03/2002} and getsymbolname="CAT" then
buy value2 shares next bar at o;
if date=1080319 {19/03/2008} and getsymbolname="AA" then
buy value2 shares next bar at o;
{}
and the portfolio setting like in the image attached, in data 20/03/2008 there is a purchase of AA. But CAT is still in portfoglio and the money earned is not usable.
Then why there' s a purchause on the second stock AA when there is no money available?
I do not understand where I go wrong...
Thanks
Riccardo
Portfolio backtester [SOLVED]
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Portfolio backtester
Hello Rgranero,
Why the earned money are not available?Hi to all,
... in data 20/03/2008 there is a purchase of AA. But CAT is still in portfoglio and the money earned is not usable.
T
Re: Portfolio backtester
Because the symbol cat is still in portfolio and the money isn' t available.
I try to explain better:
I start with 100.000,00 usd and buy 1000 stock Z at 10 USD and after 1 years stock Z is at 20 usd and is still portfolio.
Then if I want buy another stock Y I can't buy it because I haven' t money. The stock Z is still in portfolio and the money earned (stock Z from 10 to 20 = +100.000,00) isn't available.
While in backtester the money earned seems to be available.
Thanks
I try to explain better:
I start with 100.000,00 usd and buy 1000 stock Z at 10 USD and after 1 years stock Z is at 20 usd and is still portfolio.
Then if I want buy another stock Y I can't buy it because I haven' t money. The stock Z is still in portfolio and the money earned (stock Z from 10 to 20 = +100.000,00) isn't available.
While in backtester the money earned seems to be available.
Thanks
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Portfolio backtester
Current available sum of money is calculated by this formula in Portfolio Backtester:
Portfolio_Equity = InitialCapital + Portfolio_NetProfit + Portfolio_OpenPositionProfit – TotalPotentialRiskCapital
Portfolio_Equity = InitialCapital + Portfolio_NetProfit + Portfolio_OpenPositionProfit – TotalPotentialRiskCapital
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Portfolio backtester [SOLVED]
You can set a condition in script based on the following keywords:
Code: Select all
Portfolio_InvestedCapital
InitialCapital