I am doing an equity portfolio backtest on 20 symbols but I would like to size positions based on unadjusted close because in the AFL function below adjusted is what is used when data are adjusted:
SetPositionSize( 100/20, spsPercentOfEquity);
With Norgate data we can access the original close value as follows:
What I don't know is how to access current portfolio equity value. I have read knowledge base and I understand I cannot use Equity() because that's old backtester equity for one symbol and I cannot also also use ~~~equity as foreign symbol because that is populated after the backtest finishes.
So help I need is how to access current equity during a backtest. Thank you.
Thanks for taking the time to reply. I tried your code but this is what it happens:
If I include
BuyPrice = Close;
SellPrice = Close;
before restoring price arrays, the equity becomes erratic due to stock splits. I don't want to trade actual price, I only want to size based on actual price.
On the other hand, if those two lines are not added before restoring arrays nothing changes.
So I thought of this trick without changing arrays.
What do you think? It makes a difference in backtest and there are no jumps in equity but since I don't know AFL internals and I'm a rusty programmer I'm not sure it does the intended job.