Vigilant asset allocation

Hello everyone
I have read vaa paper and its excellent detail backtest on trenxplorer blog.the owner is very generous to provide complete code of the vaa strategy.The main concept is to have risky assets and non risky assets and when anyone of the risky asset show negative momentum then switch to the non risky asset .trendxplorer owner has given the complete code but I thought to implement the strategy with simple rotational system. But it is not working can anybody help me in this regard the code I have written is this
The safe asset portion is in watchlist bond and risky assets and safe asset both are in group 1

BuyPrice = Close;
TimeFrameSet( inMonthly);
SetBacktestMode( backtestRotational );
EnableRotationalTrading() ;
SetOption( "MaxOpenPositions", 1);
SetOption( "Worstrankheld", 1 );
SetPositionSize( 100, method = spsPercentOfEquity );
posscore=100*((12*(Close/Ref(C,-1)-1)+4*(Close/Ref(C,-3)-1)+2*(C/Ref(C,-6)-1)+(close/Ref(Close,-12)-1))/4);
PositionScore=IIf(posscore<0,IIf(InWatchListname("bond"),posscore+10000,posscore),posscore);
PositionScore=1000+PositionScore;

Thanks in advance

Hi,
I'm looking the code and i think you are duplicating the code "PositionScore", so may be that is the reason.
Best

You can request it to the author: https://indexswingtrader.blogspot.com/2017/07/breadth-momentum-and-vigilant-asset.html

I think that the first line assigns a value to PositionScore, and the second one updates the calculated value adding 1000 units :wink: ...

@bhartesh (although being old post of last year and seemingly not having been here since)

First read the forum rules!

As for the code... it is rubbish. That's why it does not work.

Read about proper use of TimeFrame functionality as well as
Why TimeFrameExpand is essential (Warning 509)
Why is it so difficult for you guys to follow software documentation??

Next you set rotational mode two times. Why? Just use SetBacktestMode( backtestRotational ); at top and that's it.

And SetOptions belong to top. It makes no sense to mix them with other code.

etc.

1 Like