/*[[ Name := Simple Breakout System Author := Copyright © 2005, Strategy developed by: Hans123, EA developed by: Lifestatic Link := Use M5 charts Notes := Attach to cable 5min chart Lots := 1.00 Stop Loss := 0 Take Profit := 0 Trailing Stop := 0 ]]*/ // Defines and variables; Defines: Slippage(4); Defines: StopYear(2004); Vars: i(0),BuyTrades(0),SellTrades(0); Vars: HHA(0),LLA(0),HHB(0),LLB(0); Vars: BuyA(0),SellA(0),BuyB(0),SellB(0); // Presets; if year < stopyear then exit; If Curtime - LastTradeTime < 10 then Exit; If FreeMargin < 500 then Exit; // Define High/Low Values; If TimeHour(CurTime) = 11 and TimeMinute(CurTime) = 0 then { HHA = High[1]; LLA = Low[1]; For i = 1 to 48 { If High[i] > HHA then HHA = High[i]; If Low[i] < LLA then LLA = Low[i]; }; }; If TimeHour(CurTime) = 15 and TimeMinute(CurTime) = 0 then { HHB = High[1]; LLB = Low[1]; For i = 1 to 48 { If High[i] > HHB then HHB = High[i]; If Low[i] < LLB then LLB = Low[i]; }; }; // Enter Trades; If TimeHour(CurTime) >= 11 and TimeHour(CurTime) <= 23 and Ask >= (HHA + 5*Point) and Ask < (HHA + 10*Point) and BuyA = 0 then { BuyA = 1; SetOrder(OP_BUY,Lots,Ask,Slippage,Ask-70*Point,Ask+100*Point,Blue); }; If TimeHour(CurTime) >= 11 and TimeHour(CurTime) <= 23 and Bid <= (LLA - 5*Point) and Bid > (LLA - 10*Point) and SellA = 0 then { SellA = 1; SetOrder(OP_SELL,Lots,Bid,Slippage,Bid+70*Point,Bid-100*Point,Red); }; If TimeHour(CurTime) >= 15 and TimeHour(CurTime) <= 23 and Ask >= (HHB + 5*Point) and Ask < (HHB + 10*Point) and BuyB = 0 then { BuyB = 1; SetOrder(OP_BUY,Lots,Ask,Slippage,Ask-70*Point,Ask+100*Point,Blue); }; If TimeHour(CurTime) >= 15 and TimeHour(CurTime) <= 23 and Bid <= (LLB - 5*Point) and Bid > (LLB - 10*Point) and SellB = 0 then { SellB = 1; SetOrder(OP_SELL,Lots,Bid,Slippage,Bid+70*Point,Bid-100*Point,Red); }; // Close trades at 8 am; If TimeHour(CurTime) = 9 then { BuyA = 0; BuyB = 0; SellA = 0; SellB = 0; For i = 1 to TotalTrades { If ord(i,VAL_SYMBOL) = Symbol and ord(i,VAL_TYPE) = OP_BUY then CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),Bid,Slippage,Yellow); If ord(i,VAL_SYMBOL) = Symbol and ord(i,VAL_TYPE) = OP_SELL then CloseOrder(ord(i,VAL_TICKET),ord(i,VAL_LOTS),Ask,Slippage,Yellow); }; }; // Trailing stoploss; For i = 1 to TotalTrades { If ord(i,VAL_SYMBOL) = Symbol and ord(i,VAL_TYPE) = OP_BUY and (ord(i,VAL_OPENPRICE) + 40*Point) <= Bid and ord(i,VAL_STOPLOSS) < (ord(i,VAL_OPENPRICE) - 40*Point) then ModifyOrder(ord(i,VAL_TICKET),ord(i,VAL_OPENPRICE),Bid-40*Point,ord(i,VAL_TAKEPROFIT),White); If ord(i,VAL_SYMBOL) = Symbol and ord(i,VAL_TYPE) = OP_SELL and (ord(i,VAL_OPENPRICE) - 40*Point) >= Ask and ord(i,VAL_STOPLOSS) > (ord(i,VAL_OPENPRICE) + 40*Point) then ModifyOrder(ord(i,VAL_TICKET),ord(i,VAL_OPENPRICE),Ask+40*Point,ord(i,VAL_TAKEPROFIT),White); };