Everything starts with the tick, an EA basically works on every tick, on every tick it checks something, it does somethig. No ticks - no actions at all. And when you place blocks under "on Tick", they will be exexuted and they will work. So what blocks to place there?
How to know when EMA5 is below EMA10? There is a "Condition" block for this. Do you need to check this on every tick - then connect other blocks below this one, so there will be nothing above it that will stop it for working on every tick. Do you need to check this condition sometimes, for example on every new bar - then place "Once per bar" above it.
Now that you know when EMA5 is below EMA10... you want to close all trades? There is a block called "Close trades". Just place it below that "Condition". And again, how often do you need that block to be executed? Place conditions or filters above it to make it work only when you want to.
There are very few basics when creating an EA. The first one is what I mentioned - there is an TICK event and the main code is executed on every tick. Because there is no need to do it more often or not so often, market changes because of ticks so ticks rule everything. Then... the EA contains conditions, filters and actions. Filters are basically conditions, so everything is conditions followed by actions, and those conditions are run on every tick.
Tick -> Condition (and filters) -> Actions