If I have for example 2 or more different sets of entry rules that scale in with percent of equity:
rules_1_equity_percent = 3;
rules_2_equity_percent = 4;
rules_1_short_signal = IIf(rules_1_entry, sigScaleIn, IIf(rules_1_stopped, sigScaleOut, 0));
rules_2_short_signal = IIf(rules_2_entry, sigScaleIn, IIf(rules_2_stopped, sigScaleOut, 0));
_equity_percent_per_trade = IIf(rules_1_short_signal, rules_1_equity_percent,
IIf(rules_2_short_signal, rules_1_equity_percent));
_short_signal = IIf(rules_1_short_signal , rules_1_short_signal , IIf(rules_2_short_signal , rules_2_short_signal , 0)); // Better way to code this line ?
SetPositionSize(_equity_percent_per_trade, spsPercentOfEquity);
Now when they scale out, I want each set of rules to cover exactly the same shares they shorted. And I need to short as percent of equity because I need the backtest proportional to the equity.
How can I make the scale outs match the quantities of the scale ins??