/*[[ Name := Im_Exhausted Author := Copyright © 2005, David W Honeywell Link := DavidHon@msn.com Lots := 1.00 Stop Loss := 40 Take Profit := 40 Trailing Stop := 20 ]]*/ // Time Chokes If year<2005 Then Exit; If TimeMonth(T)<1 Then Exit; If TimeDay(T)<1 Then Exit; // User Defined Variables Define: Hour_Begin(0); Define: Periods_Back(18); Define: Range_Plus_Minus(15); Define: slippage(3); // Variables that change according to price action Var: cnt(0); Var: Highe(0); Var: Lowes(0); Var: Plus_High(0); Var: Minus_High(0); Var: Plus_Low(0); Var: Minus_Low(0); Var: Current_Price(0); // Number of open trades Variable Var: Open_Trades(0); // Time Delay Variable Var: Trade_Delay(0); // Price Action Variables Definitions Highe = High[Highest(MODE_HIGH,Periods_Back,Periods_Back)]; Lowes = Low[Lowest(MODE_LOW,Periods_Back,Periods_Back)]; Plus_High = Highe+Range_Plus_Minus*Point; Minus_High = Highe-Range_Plus_Minus*Point; Plus_Low = Lowes+Range_Plus_Minus*Point; Minus_Low = Lowes-Range_Plus_Minus*Point; Current_Price = (ask+bid)/2*point; // Number of Open Trades Variable Definition Open_Trades = 0; // Time Variable Definition Trade_Delay = Period*60; // Price Choke If (Current_Price>Minus_High and Current_PriceTrade_Delay) Then { // Set Order according to our price conditions If (Plus_High>ask and ask>Minus_High) Then { SetOrder(OP_SELL,1,bid,slippage,bid+stoploss*point,bid-takeprofit*point,Gold);Exit; }; If (Plus_Low>bid and bid>Minus_Low) Then { SetOrder(OP_BUY,1,ask,slippage,ask-stoploss*point,ask+takeprofit*point,white);Exit; };};}; //---------------------------------------------------------------------------------------------------------- // If more than 1 Open trades Begin If Symbol==Symbol and Open_Trades>0 Then { // Price Choke If (Current_Price>Minus_High and Current_PriceTrade_Delay) Then { // Set Order according to our price conditions If (Plus_High>ask and ask>Minus_High) Then { SetOrder(OP_SELL,1,bid,slippage,bid+stoploss*point,bid-takeprofit*point,Gold);Exit; }; If (Plus_Low>bid and bid>Minus_Low) Then { SetOrder(OP_BUY,1,ask,slippage,ask-stoploss*point,ask+takeprofit*point,white);Exit; };};}; // Trailing Stop Choke if TrailingStop<5 then { print("Invalid trailing stop"); Exit; }; // Open Trades Confirmation , All Trades For cnt=1 to TotalTrades { // Open Trades per Symbol Counter If OrderValue(cnt,Val_Symbol)=Symbol Then { Open_Trades=Open_Trades+1; }; // Trailing Stop If Ord(cnt,Val_Symbol)=Symbol and Ord(cnt,VAL_TYPE)=OP_BUY then { If (Bid-Ord(cnt,VAL_OPENPRICE))>(TrailingStop*Point) then { If Ord(cnt,VAL_STOPLOSS)<(Bid-TrailingStop*Point) then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE), Bid-TrailingStop*Point,Ord(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; If Ord(cnt,Val_Symbol)=Symbol and Ord(cnt,VAL_TYPE)=OP_SELL then { If (Ord(cnt,VAL_OPENPRICE)-Ask)>(TrailingStop*Point) then { If Ord(cnt,VAL_STOPLOSS)>(Ask+TrailingStop*Point) or Ord(cnt,VAL_STOPLOSS)=0 then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE), Ask+TrailingStop*Point,Ord(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; };