/*[[ Name := Your_Choice_Hourly_Pivot Author := Copyright © 2006 , David W Honeywell , Bud Foxx Link := http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ Notes := created from an idea introduced by Bud Foxx ( budfoxwallstreet@yahoo.com ). Notes := Bud posted his idea at Notes := http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ , message # 38488 Notes := default settings , GBP/USD , H1 Lots := 0.10 Stop Loss := 1 Take Profit := 0 Trailing Stop := 0 ]]*/ /* Terms Of Use = By Entering Any Value Other Than 0 (zero) in the "IAcceptTerms" definition , "You" ( the user ) , "Accept Full Unlimited Responsibility Of The Operation And Results Obtained From The Use Of This Expert Advisor" , "Use At Your Own Risk" . */ If TimeYear(T) < 2005 Then Exit; Define: IAcceptTerms(0); // Default(0) = No , Any Other Value = Yes . If (IAcceptTerms==0) Then Exit; If (IAcceptTerms<>0) Then { Defines: mm(0),risk(1); Variables: lotsi(0),phigh(0),plow(0),ppivot(0),copen(0),contrarian(0), int(0),vtime(0),stplss(0),tkprft(0); If mm<>0 then { lotsi=Ceil(Balance*risk/10000)/10; } else { lotsi=Lots; }; If lotsi < 0.10 then { lotsi = 0.10; }; If lotsi > 50 then { lotsi = 50; }; phigh = (High[Highest(MODE_HIGH,24,24)]); // Highest High of the previous 24 bars plow = (Low[Lowest(MODE_LOW,24,24)]); // Lowest Low of the previous 24 bars ppivot = (phigh+plow+Close[1])/3; // Pivot price of the previous 24 bars copen = Open[0]; // Current bar open price If (Hour == 11) Then { contrarian = 10; }; // default == 11 , 10 If (Hour == 13) Then { contrarian = -10; }; // default == 13 , -10 If (Hour == 17) Then { contrarian = 10; }; // default == 17 , 10 If (StopLoss == 0) then { stplss = 0; }; If (TakeProfit == 0) then { tkprft = 0; }; If (CurTime-LastTradeTime) < 10 then exit; If ((Hour == 11) or (Hour == 13) or (Hour == 17)) Then // default == 11 , 13 , 17 { For int = 1 To TotalTrades { If (Ord(int,VAL_SYMBOL) == Symbol) Then { If ( Time[0] > (Ord(int,VAL_OPENTIME)+84400) ) Then // if order is 24 hours old 86400 seconds { CloseOrder(Ord(int,VAL_TICKET),Ord(int,VAL_LOTS),Ord(int,VAL_CLOSEPRICE),0,White); } } //If (Ord(int,VAL_OPENTIME) > 0)and(Time[0] > Ord(int,VAL_OPENTIME)) Then vtime = 0; // does not work if backtesting }; If ((DayOfWeek != 4) or (DayOfWeek != 6)) Then // default == do not trade on days 4(weds) or 6(fri) { If (DayOfWeek == 4) Then Exit; If (DayOfWeek == 6) Then Exit; If (contrarian > 0) Then // true { If (vtime != Time[0]) Then { If ((copen < phigh) and (copen > plow) and (copen > ppivot)) Then { If (StopLoss != 0) then stplss = phigh+20*Point; If (TakeProfit != 0) then tkprft = Bid-TakeProfit*Point; SetOrder(OP_SELL,lotsi,Bid,3,stplss,tkprft,Gold); vtime = Time[0]; }; If ((copen < phigh) and (copen > plow) and (copen < ppivot)) Then { If (StopLoss != 0) then stplss = plow-20*Point; If (TakeProfit != 0) then tkprft = Ask+TakeProfit*Point; SetOrder(OP_BUY,lotsi,Ask,3,stplss,tkprft,Gold); vtime = Time[0]; }; } }; If (contrarian < 0) Then // false { If (vtime != Time[0]) Then { If ((copen < phigh) and (copen > plow) and (copen < ppivot)) Then { If (StopLoss != 0) then stplss = phigh+20*Point; If (TakeProfit != 0) then tkprft = Bid-TakeProfit*Point; SetOrder(OP_SELL,lotsi,Bid,3,stplss,tkprft,Gold); vtime = Time[0]; }; If ((copen < phigh) and (copen > plow) and (copen > ppivot)) Then { If (StopLoss != 0) then stplss = plow-20*Point; If (TakeProfit != 0) then tkprft = Ask+TakeProfit*Point; SetOrder(OP_BUY,lotsi,Ask,3,stplss,tkprft,Gold); vtime = Time[0]; }; } }; };//if day of week != };//if hour == };//if accept terms <> 0 Exit;