@Tomasz TomasZ, Your suggestion is WRONG and RIDICULOUS !!! 
Give me a solution and I will buy an upgrade that very moment !! I challenge you !
I put my money where my mouth is. Prove it !!!
Below is my redacted code.
swtf_Matrix= MxFromString("{{1, 2, 3, 5, 6, 7, 9, 11, 13, 15, 18, 22, 25, 30, 35}}");
for( swtf_counter_Matrix=0 ; swtf_counter_Matrix<MxGetSize( swtf_Matrix, 1 )-1 ; swtf_counter_Matrix++ )
//for( swtf_counter = swtf_counterStartValue; swtf_counter >= swtf_counterEndValue; swtf_counter = swtf_counter - step )
{
thisSWTF=swtf_Matrix[0][swtf_counter_Matrix];
timeIntervalForThisSubwaveForThisIteration = in1Minute * thisSWTF;
//swtf_counter=thisSWTF;
_TRACE( "swtf_counter=" + thisSWTF );
//timeIntervalForThisSubwaveForThisIteration = swtf_counter * in1Minute * ;
timeIntervalForThisSubwaveForThisIterationInSeconds = thisSWTF * 60;
patternFound_Parent_CompressedToSWTF=TimeFrameCompress( patternFound_Parent_Expanded, timeIntervalForThisSubwaveForThisIteration, compresslast );
//keep the value of last bar in range (because the expanded array 'executeOrNot_Expanded' will have the required value on the very last bar of the range)
if( timeIntervalForThisSubwaveForThisIteration < timeframeBaseInSeconds )
{
_TRACE( "thisSWTF=" + thisSWTF + ", timeIntervalForThisSubwaveForThisIterationInSeconds" + timeIntervalForThisSubwaveForThisIterationInSeconds + " was less than timeframeBaseInSeconds=" + timeframeBaseInSeconds + ". Hence breaking sw loop" );
break;
}
parentAndSWTFMultiplicationFactor = timeIntervalOfParentPatternInSeconds / timeIntervalForThisSubwaveForThisIteration;
TimeFrameSet( timeIntervalForThisSubwaveForThisIterationInSeconds );
calculateBarScore();
//In This SubWave Timeframe
DateTimeOfThisBarMatchForThisSWForAnySW=DateTimeOfThisBarMatchForThisSW1=DateTimeOfThisBarMatchForThisSW3=DateTimeOfThisBarMatchForThisSW5=0;
for(swCounter=swCounterStartValue;swCounter<=swCounterMaxValue;swCounter=swCounter+swCounterStep)
{
VarSet("patternFound_SW", Nz(find5LeggedPattern( subwavePatternTypeToFindArray, swlookbackbarsCounterMinValue, swlookbackbarsRange, discoveryModeFindSubWave, DateTimeOfThisBarMatchForThisSWForAnySW)));
for(swCounter=swCounterStartValue;swCounter<=swCounterMaxValue;swCounter=swCounter+swCounterStep)
{
VarSet("patternFound_SW"+swCounter, VarGet("DateTimeOfThisBarMatchForThisSW"+swCounter) && VarGet("patternFound_SW"));
fillWaveValues( swCounter, 1);
timeframerestore();
//In Base-TimeFrame
VarSet("DateTimeOfThisBarMatchForThisSW"+swCounter+"Expanded", TimeFrameExpand( VarGet("DateTimeOfThisBarMatchForThisSW"+swCounter), timeIntervalForThisSubwaveForThisIteration ));
VarSet("DateTimeOfThisBarMatchForThisSWForAnySWExpanded", TimeFrameExpand( DateTimeOfThisBarMatchForThisSWForAnySW, timeIntervalForThisSubwaveForThisIteration ));
VarSet("subwavePatternTypeToFindArrayExpanded", TimeFrameExpand( subwavePatternTypeToFindArray, timeIntervalForThisSubwaveForThisIteration ));
VarSet("patternFound_SW"+swCounter+"Expanded", TimeFrameExpand( VarGet("patternFound_SW"+swCounter), timeIntervalForThisSubwaveForThisIteration ));
VarSet("patternFound_SW"+swCounter+"CompressedToParentTF", TimeFrameCompress( VarGet("patternFound_SW"+swCounter+"Expanded"), timeIntervalOfParentPatternInSeconds, compressHigh ));
VarSet("Point0_SW"+swCounter+"Expanded", TimeFrameExpand( VarGet("Point0_SW"+swCounter), timeIntervalForThisSubwaveForThisIteration ));
VarSet("Point0_SW"+swCounter+"ExpandedAndPruned", IIf( VarGet("patternFound_SW"+swCounter+"Expanded"), VarGet("Point0_SW"+swCounter+"Expanded"), Null ));
VarSet("Point0_SW"+swCounter+"CompressedToParentTF", TimeFrameCompress( VarGet("Point0_SW"+swCounter+"ExpandedAndPruned"), timeIntervalOfParentPatternInSeconds, compressHigh ));
VarSet("barRefPoint0_SW"+swCounter+"Expanded", TimeFrameExpand( barRefPoint0, timeIntervalForThisSubwaveForThisIteration ));
VarSet("barRefPoint0_SW"+swCounter+"ExpandedAndPruned", IIf( VarGet("patternFound_SW"+swCounter+"Expanded"), VarGet("barRefPoint0_SW"+swCounter+"Expanded"), Null ));
VarSet("barRefPoint0_SW"+swCounter+"CompressedToParentTF", TimeFrameCompress( VarGet("barRefPoint0_SW"+swCounter+"ExpandedAndPruned"), timeIntervalOfParentPatternInSeconds, compressHigh ));
VarSet("winnerLookbackbar_SW"+swCounter+"Expanded", TimeFrameExpand( winnerLookbackbar, timeIntervalForThisSubwaveForThisIteration ));
VarSet("winnerLookbackbar_SW"+swCounter+"ExpandedAndPruned", IIf( VarGet("patternFound_SW"+swCounter+"Expanded"), VarGet("winnerLookbackbar_SW"+swCounter+"Expanded"), Null ));
VarSet("winnerLookbackbar_SW"+swCounter+"CompressedToParentTF", TimeFrameCompress( VarGet("winnerLookbackbar_SW"+swCounter+"ExpandedAndPruned"), timeIntervalOfParentPatternInSeconds, compressHigh ));
//determination of ImpulseEndingWithVerifiedSubwave will be done in Parent TF
TimeFrameSet( timeIntervalOfParentPatternInSeconds );
effStartBarIndex = getEffectiveStartBarIndx();
VarSet("DistanceOfP0OfCorrect_SW"+swCounter, IIf( VarGet("executeForSW"+swCounter+"InParentTF") , VarGet("DistanceOfCorrect_SW"+swCounter) + Ref( round( VarGet("barRefPoint0_SW"+swCounter+"CompressedToParentTF") / parentAndSWTFMultiplicationFactor ), -1 * VarGet("DistanceOfCorrect_SW"+swCounter) ), VarGet("DistanceOfP0OfCorrect_SW"+swCounter) ));
VarSet("ParentSubwavePLRatioForSW_"+swCounter, IIf( VarGet("executeForSW"+swCounter+"InParentTF"), Ref( VarGet("PriceLength05_SW"+swCounter+"CompressedToParentTF"), -1 * VarGet("DistanceOfCorrect_SW"+swCounter) ) / IIf(swCounter==5, VarGet( "PriceLengthWave5_Parent" ), IIf(swCounter==3, VarGet( "PriceLengthWave3_Parent" ), VarGet( "PriceLengthWave1_Parent" ))), VarGet("ParentSubwavePLRatioForSW_"+swCounter) ) );
VarSet("ParentBSubwavePLRatioForSW_"+swCounter, IIf( VarGet("executeForSW"+swCounter+"InParentTF"), Ref( VarGet("PriceLength05_SW"+swCounter+"CompressedToParentTF"), -1 * VarGet("DistanceOfCorrect_SW"+swCounter) ) / IIf(swCounter==5, VarGet( "PriceLengthWave54b_Parent" ), IIf(swCounter==3, VarGet( "PriceLengthWave32b_Parent" ), VarGet( "PriceLengthWave1Nominal_Parent" ))), VarGet("ParentBSubwavePLRatioForSW_"+swCounter) ) );
VarSet("ImpulseEndingWithVerifiedSubWave"+swCounter+"Found", IIf( VarGet("executeForSW"+swCounter+"InParentTF"), patternFound_Parent && VarGet("DistanceOfCorrect_SW"+swCounter) <= IIf(swCounter==5, VarGet( "barRefWave5_Parent" ), IIf(swCounter==3, VarGet( "barRefWave3_Parent" ), VarGet( "barRefWave1_Parent" ))) && !IsNull( VarGet("DistanceOfCorrect_SW"+swCounter) ) && IIf( swCounter==5 && VarGet("DistanceOfCorrect_SW"+swCounter) < 0, abs( VarGet("DistanceOfCorrect_SW"+swCounter) ) <= VarGet( "barlength05_Parent" ) / 5, 1 ) && VarGet("ParentBSubwavePLRatioForSW_"+swCounter) >= 5 / 10, VarGet("ImpulseEndingWithVerifiedSubWave"+swCounter+"Found" )));
VarSet("ImpulseEndingWithVerifiedSubWave"+swCounter+"FoundExpanded", TimeFrameExpand( VarGet("ImpulseEndingWithVerifiedSubWave"+swCounter+"Found" ), timeIntervalOfParentPatternInSeconds ));
//CODE below is NOT POSSIBLE because VarGet("ImpulseEndingWithVerifiedSubWave"+swCounter+"FoundExpanded") is array and NOT a Scalar. In afl loops can be broken based on scalar NOT based on array
//For argument lets assume that the concerned array is true at swtf_counter_Matrix=1 (first loop counter) ideally i should come out of the loop but that is not possible due to amibroker architecture And I have to loop through till the very end
//of the swtf_counter_Matrix i.e swtf_counter_Matrix=35 even though execution till swtf_counter_Matrix=1 was adequate for THAT bar. THIS IS A MAJOR DRAWBACK OF AFL AMIBROKER ARCHITECTURE but one that i have to live with because thats the
//way parallelism is achieved. It is not a drawback but a tradeoff.
if(VarGet("ImpulseEndingWithVerifiedSubWave"+swCounter+"FoundExpanded"))
break;
}//sw loop
}//sw tf loop