Save multiple ~~~equity in optimization

Hi all!

I saw a similar post, but I still can't figure out how to save the ~~~equity to a new ticker before another optimization run. I do 4 runs with different betsizing methods. Then I have an indicator that is supposed to show all 4 graphs for easy comparison, but it doesn't work. I guess I don´t fully understand the details of the backtesting/optimization yet, so any help is greatly appreciated.

Here is my code for setting things up

betsize_method = Optimize("betsize_method", 3, 1, 4, 1);
.
.
if ( Status( "action" ) == actionBacktest ) {
	BuyPrice = CoverPrice = SellPrice = ShortPrice = Close;
	setup_us_entry_arrays();
	setup_us_exit_arrays();
	generate_us_signals();
	
	AddToComposite( Foreign( "~~~EQUITY", "C"), "~~~EQUITY_"+betsize_method, "C", atcFlagDeleteValues | atcFlagEnableInBacktest );
}

and then in my indicator afl looks like this

SetChartOptions( 0, chartShowArrows|chartShowDates );
 
Plot( Foreign("~~~EQUITY_4", "C"), "EQUITY_4", colorAqua, styleLine);
Plot( Foreign("~~~EQUITY_3", "C"), "EQUITY_3", colorBlueGrey, styleLine);
Plot( Foreign("~~~EQUITY_2", "C"), "EQUITY_2", colorLightBlue, styleLine);
Plot( Foreign( "~~~EQUITY", "C"), "EQUITY", colorOrange, styleLine);

The values are way off and I can't figure out why.. Looks like ~~~equity 2 to 4 are huge and the same value, and ~~~equity looks normal

Thanks!

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.