Thanks mradtke, I used your snippet and tried to change it for my 'dynamic' position sizing but I can't figure this one out. I have posted the entire formula below in hopes I'll get a bit more insight into my shortcomings.

Looping through the signals works but what I am left with is just the signals where the limit price has been hit, which doesn't translate to live trading. If I have 2 available positions (and sufficient cash), I want only the top 2 ranked signals in the market whether they hit the limit or not.

For example, this are the signals that make it through. 4 open positions, 1 available.

With the results below from an exploration, I would expect CXL.au to be the only 'considered' signal even though it did not hit the limit price. The 3 signals that have been generated are the 3 from the total list that did hit the limit price.

I don't expect the complete answer from anyone but I would like to know how this works because I'm lost. Not sure if I also need to be using some static ranks function for what I want to do.

```
#include_once "Formulas\Norgate Data\Norgate Data Functions.afl"
/* CBT & More */
if( Status( "action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
for( i = 0; i < BarCount; i++ )
{
posQty = bo.GetOpenPosQty();
pSize = IIf( bo.Equity <= 50000, 0.20 * bo.Equity, 10000);
maxPos = IIf( bo.Equity <= 50000, 5, 15);
for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i ) )
{
if( sig.IsEntry() )
{
posQty++;
lowArray = Foreign( sig.Symbol, "L" );
if( posQty > maxPos OR lowArray[i] > sig.Price )
{
sig.Price = -1;
}
}
sig.PosSize = pSize;
}
bo.ProcessTradeSignals( i );
}
bo.PostProcess();
}
function ConnorsRSI( lenRSI, lenUD, lenROC )
{
upDays = BarsSince( C <= Ref( C, -1 ) );
downDays = BarsSince( C >= Ref( C, -1 ) );
updownDays = IIf( upDays > 0, upDays, IIf( downDays > 0, -downDays, 0 ) );
crsiT = ( PercentRank( ROC( C, 1 ), lenROC ) + RSIa( updownDays, lenUD ) + RSI( lenRSI ) ) / 3;
return crsiT;
}
/* Set Options */
SetOption( "EveryBarNullCheck", True );
SetOption( "InitialEquity", 10000 );
SetOption( "AllowSameBarExit", False );
//SetOption( "MaxOpenPositions", 15 );
SetOption( "CommissionMode", 2 );
SetOption( "CommissionAmount", 5 );
SetOption( "UsePrevBarEquityForPosSizing", True );
//SetOption( "PortfolioReportMode", 0 );
SetTradeDelays( 0, 0, 0, 0 );
SetBacktestMode( backtestRegular );
SetOption( "ActivateStopsImmediately", True );
SetOption("usecustombacktestproc", True);
SetOption("PriceBoundChecking", False);
SetOption("AllowPositionShrinking", True);
SetCustomBacktestProc( "" );
RoundLotSize = 1;
/* Ranking/Score */
PositionScore = Ref((1000 + ROC( Close, 150 )), -1);
positionScoreE= 1000 + ROC( Close, 150 );
/* Parameters */
_SECTION_BEGIN( "ConnersRSI" );
p_crsiLength = Param( "cRSI Length", 3, 2, 100, 1 );
P_crsiUd = Param( "cRSI UpClose Length", 2, 2, 100, 1 );
p_crsiROC = Param( "PerecentRank Length", 100, 10, 200, 1 );
p_rsiObLev = Param( "cRSI Overbought", 65, 1, 100, 1 );
p_rsiOsLev = Param( "cRSI Oversold", 15, 1, 100, 1 );
crsiInd = ConnorsRSI( p_crsiLength, P_crsiUd, p_crsiROC );
_SECTION_END();
_SECTION_BEGIN( "Misc." );
p_pctBelow = Param( "Entry Target x% Below", 2, 0.5, 100.00, 0.5 );
_SECTION_END();
/* Buy Conditions */
crsiHitOs = Cross( p_rsiOsLev, crsiInd );
volAbLimit = MA( Volume * Close, 10 ) > 300000;
enterLong = ( MA( Close, 50 ) > MA( Close, 300 ) AND volAbLimit AND Close < 100 AND crsiHitOs AND NorgateIndexConstituentTimeSeries( "$XAO.au" ) );
/* Buy */
entryTarget = Ref(Low, -1) - ((p_pctBelow/100) * Ref(Low, -1));
entryTargetEX = Low - ((p_pctBelow/100) * Low);
BuyPrice = IIf( Open < entryTarget, Open, entryTarget );
Buy = ( Ref( enterLong, -1 ) ) AND( Low < entryTarget );
/* Sell */
exitLong = Cross( crsiInd, p_rsiObLev );
SellPrice = Open;
Sell = Ref( exitLong, -1 );
ApplyStop( stopTypeNBar, stopModeBars, 15 );
/* Exploration / Scan */
Filter = enterLong; // OR Sell;
AddColumn( entryTargetEX, "Entry Price" );
AddColumn( Open, "Open" );
AddColumn( High, "High" );
AddColumn( Low, "Low" );
AddColumn( Close, "Close" );
AddColumn( positionScoreE, "Pos Score");
AddColumn(MA( Volume * Close, 10 ), "Vol Avg $");
```