Rotational Re-Balance Strategy Code

Hello All,

The code below executes a weekly rebalance between two ETFs. The system works as I have run backtests that show ROI that beats the S&P and the NASDAQ using TQQQ and TMF.

However I'd like to plot the ongoing equity line but I can't get my plot statement to put out anything. My display window shows dates but no equity curve.

Also I'd like to modify the code to use asymmetric weightings such as 60/40 for two ETFs or 70/20/10 for three ETFs.

I'd appreciate any insight , guidance or references that the community could point me to.

Thanks,

Bernie

SetBarsRequired(sbrAll,0); 
SetChartOptions(0,chartShowArrows|chartShowDates);
SetOption("UseCustomBacktestProc", True );
SetBacktestMode( backtestRotational );
EnableRotationalTrading();
SetTradeDelays( 0,0,0,0 );
firstdayofweek	= DayOfWeek() < Ref( DayOfWeek(), -1 );
EachPosPercent = 50;
PositionScore = IIf( firstdayofweek, 1, scoreNoRotate );
PositionSize = -EachPosPercent;
SetOption( "InitialEquity", 100000 );
SetOption( "WorstRankHeld", 2 );
SetOption( "MaxOpenPositions", 2 );


if( Status( "action" ) == actionPortfolio )
{
    bo = GetBacktesterObject();
    bo.PreProcess();
    for( bar = 0; bar < BarCount; bar++ )
    {
        bo.ProcessTradeSignals( bar );
        CurEquity = bo.Equity;
        Plot(CurEquity,"RUNNING EQUITY",colorRed,styleThick);
        if( firstdayofweek[bar] == 1 )
        {
            for( pos = bo.GetFirstOpenPos(); pos; pos = bo.GetNextOpenPos() )
            {
                posval = pos.GetPositionValue();
                diff = posval - 0.01 * EachPosPercent * CurEquity;                
                price = pos.GetPrice( bar, "O" );
                if( diff != 0 AND abs( diff ) > price )
                {
                    bo.ScaleTrade( bar, pos.Symbol, diff < 0, price, abs( diff ) );
                    
                }
            }
        }
    }
    bo.PostProcess();
    
}

brosario,

I don't notice a prior reply here.

Did you receive assistance off-post (from somewhere else) that you can share here?

Best regards,

Hello, I never saw a reply, but that's ok, no worries, I've moved on. Thanks for asking.