ExRem removes ALL extra signals FROM THE BEGINNING of available data and NOT from your "range". Generally speaking ExRem should NOT be used. Backtester removes extra signals on its own http://www.amibroker.com/guide/h_portfolio.html
Always I mean ALWAYS use this advice if you don't understand how your code works: How do I debug my formula?
No one is going to fix your codes unless you understand what you are doing yourself.