SUMMARY I need an EA that trades based on candle pattern on timeframe H1. It must check and correctly process possible errors in trading operations. Entry based on prices of last 3 bars. Exit based on SL/TP and number of bars elapsed since opening position. INPUTS x1a = 0.1 // min variace for long x1b = 0.1 // min variance for short y1 = 0.2 // max variance ExitAfterLong = 24 // no of bars after which positions are closed ExitAfterShort = 18 // no of bars after which positions are closed Time1 = 06 // hour filter for long Time2 = 07 // hour filter for short DayofWeekFilter = // exclude or not trades on Friday MONEY MANAGEMENT position size = // in % of account equity position size = // in fixed lot SLlong= // stop loss in % of distance from open trade price TPlong = // take profit in % of distance from open trade price SLshort= // stop loss in % of distance from open trade price TPshort = // take profit in % of distance from open trade price VARIABLE sum = Absvalue(open-close)+Absvalue(open[1]-close[1])+Absvalue(open[2]-close[2]); CONDITIONS Condition1 = close > open and close[1] > open[1] and close[2] > open[2]; Condition2 = close < open and close[1] < open[1] and close[2] < open[2]; Condition3 = sum > (x1a*close) and sum < (y1*close); Condition4 = sum > (x1b*close) and sum < (y1*close); Condition5 = close