Question about Order Place Code at Amibroker

I am using Amibroker

I wanna write a code that "xLine=EMA(40)",
mainly BUY above xLine and SHORT below xLine

For Long order placing....
Buy Immediately when High cross xLine
But if same bar close < xLine, then (Cut Loss and Reverse) Sell and Short
else if Cross(Low, xLine) then (Take profit and Reverse) Sell and Short

For Short order placing, is exactly the opposite.

Would you mind teach me how to write the code for the above action?
Many Thanks!!!

 
Back
Top