SUMMARY I need an EA in MT5 that trades based on candle pattern on timeframe H3. It must check and correctly process possible errors in trading operations. Entry based on exponential averages. Exit based on SL/TP and number of bars elapsed since opening position. INPUTS TimeStart = 06 // time filter start to open positions TimeEnd = 15 // time filter end to open positions SundayOff = true // exclude or not trades on Sunday (true/false) FridayOff = true // exclude or not trades on Friday (true/false) ExpFastOpen = 10 // Fast Exponential average to open position ExpSlowOpen = 100 // Slow Exponential average to open position LinearPeriod = 10 // Linear regression period x1 = 0.013 // marginebv if close>open x2 = 0.0115 // marginebv if close Exponentialaverage [ExpFastOpen] (close); Condition2 = close < Exponentialaverage [ExpSlowOpen] (close); Condition3 = close < close [1]; Condition4 = LinearRegressionSlope[LinearPeriod] (close) > 0; Condition5 = close < Exponentialaverage [ExpFastExit] (close); Condition6 = close > Exponentialaverage [ExpSlowExit] (close); RULES TO OPEN LONG POSITION If no opened position AND time >= TimeStart AND time <= TimeEnd AND day of week filter AND Condition1 AND Condition2 AND Condition3 AND Condition4 then Buy position size at market RULES TO EXIT POSITIONS If long position opened AND Condition5 AND Condition6 then Sell at market Other option to close based on number of bars elapsed after opened time (input ExitAfter) Set SL and TP based on position open price if close>open then marginebv=low-x1*close elsif close