Hi, I’m trying to do some portfolio testing using different asset allocations. For example, I’d like to do a portfolio test that purchases 20% TLT, 60% MDY, and 20% GLD on January 1,2000 and hold it until September 1, 2017. This is what I have so far, which obviously doesn’t work. I’m not sure how to best incorporate the setpositionsize statement. Should I use a regular if statement? If so, how?
Thanks for any help!
Tony
//3 fund allocations
SetPositionSize(IIf(Name()=="MDY",60,0),spsPercentOfEquity);
SetPositionSize(IIf(Name() =="GLD",20,0),spsPercentOfEquity);
SetPositionSize(IIf(Name() =="TLT",20,0),spsPercentOfEquity);
Buy=DateNum()==010101;
Sell=DateNum()==170901;
@TonyR I’m glad you figured it out, but you may need to consider that GLD was not listed until Nov 2004. So you can’t back test it from Jan 2000 (and TLT sometime in July 2002 I believe).
Yes, that was ONE of the issues, I did eventually get it to work. I like your username, I have a feeling I’m going to be asking you for a lot of help as I begin to develop asset allocation strategies. I’m working on doing quarterly/monthly rebalances as well, however what metric to use for the position score is the million dollar question, isn’t it.
Thanks for the reply and the useful hints! Appreciate it!
Tony
Thank you Tomasz, I ended up using nested iif statements with each of my instruments I needed, but yours was far more eloquent as I expected. Thank you very much for the solution! Truly a great program with great support!
Kindest Regards,
Tony