/*[[ Name := BudFoxxOfWallStreetNewIdea!v2 Author := Bud Foxx Link := http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ Lots := 0.10 Stop Loss := 0 Take Profit := 0 Trailing Stop := 0 ]]*/ If TimeYear(T) < 2006 then exit; Define : Hmm(1),risk(25); Variables: popen(0),phigh(0),plow(0),pmedian(0),copen(0),spread(0),lotsi(0),int(0); popen = Open[1]; phigh = High[1]; plow = Low[1]; pmedian = (H[1]+L[1])/2; copen = Open[0]; spread = (Ask-Bid); If (CurTime-LastTradeTime) < 10 then exit; if Hmm<>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; } For int = 1 To TotalTrades { If (Ord(int,VAL_SYMBOL) == Symbol) Then { If (Ord(int,VAL_OPENTIME) < Time[0]) Then { CloseOrder(Ord(int,VAL_TICKET),Ord(int,VAL_LOTS),Ord(int,VAL_CLOSEPRICE),0,White); } } }; If (TotalTrades <= 0) Then { If ((copen < phigh) and (copen > plow) and (copen > pmedian) and (Bid >= copen+spread)) Then { SetOrder(OP_SELL,lotsi,Bid,3,0,0,Gold); } If ((copen < phigh) and (copen > plow) and (copen < pmedian) and (Ask <= copen-spread)) Then { SetOrder(OP_BUY,lotsi,Ask,3,0,0,Gold); } }; //Comment("spread ",spread," , ",copen+spread," , ",copen-spread); Exit;