Multiple signals order ( Exrem on multiple arrays)?

So my setup has 3 moving averages. Green (fast moving average), red (meduim moving average) and blue (slow moving average). Now I want to plot a shape named 1 when prices touch my green average, plot shape named 2 when prices touch my red average and 3 when prices touch my blue average and then when prices close above green average, I want to plot arrow which is a shape to buy.

Now I want them in order. I.e if lets say 3 occurs, then I don't want to plot 1 or 2 since its bearish now. I would only want to plot arrow if buy comes. So after 3 shape I only want buy shape and disregard 1 and 2 shapes.
How do I do that ? Exrem is not working here. I am not buying or selling in this code. This is just for plotting shapes and visualising the setup.
Please help

@besttrader, i am not an expert in this forum to advise but please post the code that you have done so far, so someone might look into that and provide their suggestions.

Okay so here is the code.


Plot(AlligatorBlue,"Jaw",colorBlue,1+4+styleNoTitle );
Plot(AlligatorRed,"Language (Teeth)",colorRed,1+4+styleNoTitle );
Plot(AlligatorGreen,"Lips",colorLime ,1+4+styleNoTitle );

BCond0 = Cross(close,alligatorgreen) AND Close>MA(Close,50) AND AlligatorGreen > alligatorred AND alligatorred > alligatorblue;
Scond1 = Cross(alligatorgreen,Close) AND AlligatorGreen > alligatorred AND alligatorred > alligatorblue AND Close>MA(Close,50);
Scond2 = Cross(alligatorred,Close) AND Close < alligatorgreen AND alligatorgreen > alligatorblue AND Close>MA(Close,50);
Scond3 = Cross(alligatorblue,Close) OR Cross(alligatorred,alligatorgreen) ;

PlotShapes(IIf(Bcond0,shapeUpArrow,shapeNone),colorGreen,0,L,Offset = -50);
PlotShapes(IIf(Scond1,shapeDigit1,shapeNone),colorYellow,0,L,Offset = -50);
PlotShapes(IIf(Scond2,shapeDigit2,shapeNone),colorYellow,0,L,Offset = -50);
PlotShapes(IIf(Scond3,shapeDigit3,shapeNone),colorYellow,0,L,Offset = -50);

Guys please assist me with this

@besttrader, could you please explain this in a picture ? i tried to understand this but could not understand. also let people know what is the time frame you are working on .. thanks.

Lets say I have 3 signals
cond 1 = crossover (c,10);
cond2 = crossover (c,30) ;
cond3 = crossover (c,50);

Now I want them in order. I.e I first want cond1 if it happens, then cond2 and then cond3 if it happens
If cond3 happens after cond1 , then ignore cond3 and take only cond2 when it happens. Likewise, I want cond1 only once (i.e dont take multiple signal of cond1 again and again).
So order should be like this
cond1 then cond2 then cond3 then cond1 --- and so on

So in a nutshell all I want here is to set the order of signals. So if a signal comes which is not in order, I want it to ignore it and wait for the signal lined in order to come
Does that make sense?

function SignalGen( array1, array2,array3 )

	for(i = 0; i < BarCount; i++)
		CombinedSell[i] = 0;
			if(array1[i]== True)
					if(array2[j]== True)
						  if(array3[k]== True)
								CombinedSell[i]= True;
								//need to modify j and i values, once we have a successful value
								if(k+1<BarCount && array1[k+1] == True)
						 // break;
					if(j+1<BarCount && array1[j+1] == True)
	return CombinedSell;	

@besttrader I am not sure, if this helps or not but you can give it a try. If it's for backtesting, it take some time and filters the signals.. You may have to do some changes to the logic, i haven't tested it entirely. (i am sorry for that). I am sure, if there is an efficient way, people in the forum will definitely help you.