ValueWhen serves no purpose here and is redundant.
Also note that the value that you are really calculating with all that convoluted code is simple > (greater than), so you could achive the same as simply as:
TagArray1 = Short_EMA > Long_EMA; // that what it really is
I tried the code Dr. Tomasz, I suppose the valuewhen bit what fxshrat has used is because when using flip, the last bar where EMA_CO_Down is true does not get tagged.
And on the 2nd point, I understand completely what you have conveyed, will get better with this, thank you.
The same with greater operator code, you can achieve what you want with:
TagArray1 = Short_EMA > Long_EMA OR EMA_CO_Down;
or version with Hold:
TagArray1 = Hold( Short_EMA > Long_EMA, 2 );
Also note that I would be very careful with including this "down" point because at that bar, the long time average is ALREADY below short time and keeping positions longer usually results in trading loses (keep in mind that averages ALWAYS introduce delays, so the signals are DELAYED already - what you are trying to do is essentially increasing this delay by one extra bar and it is really bad idea because delays in response always result in bad system performance ).