/*[[ Name := Daily Trading Author := Copyright © 2005, afahmic Notes := Inspired by autofx's SimpleEagle expert. := Attach to D1 chart, to almost all pairs (except EURGBP/EURCHF due to their low volatility), := then check the results, especially for the almost perfect win/loss ratio. Lots := 1 Stop Loss := 100 Take Profit := 1000 Trailing Stop := 100 ]]*/ Defines: Leverage(10), EntryPips(50), DirPips(25), TailPips(25), MoneyManagement(1), EnableTS(0); Var: LotSize(10000), Slippage(5), LotMax(50), MinSpread(3), MultiPairs(1), MinMargin(50), LotMM(0), CurrentPairTrades(0), SellColor("Orange"), BuyColor("Magenta"), cnt(0); If TimeYear(Time[0]) < 2004 then Exit; // INTERBANKFX LOT COMPOUNDING ========================== If MoneyManagement <> 0 then { LotMM = (FreeMargin*Leverage/LotSize); If LotMM < 2 then { LotMM = Lots; } If LotMM = 2 then { LotMM = 2; } If LotMM > 2 and LotMM < 10 then { LotMM = Ceil(FreeMargin*Leverage/LotSize)-1; } If LotMM >= 10 and LotMM < 15 then { LotMM = 10; } If LotMM >= 15 and LotMM < 20 then { LotMM = 15; } If LotMM >= 20 and LotMM < 25 then { LotMM = 20; } If LotMM >= 25 and LotMM < 30 then { LotMM = 25; } If LotMM >= 30 and LotMM < 35 then { LotMM = 30; } If LotMM >= 35 and LotMM < 40 then { LotMM = 35; } If LotMM >= 40 and LotMM < 45 then { LotMM = 40; } If LotMM >= 45 and LotMM < LotMax then { LotMM = 45; } If LotMM >= LotMax then { LotMM = LotMax; } } Else { LotMM = Lots; } // MULTIPAIRS OPTION ==================================== CurrentPairTrades = 0; If MultiPairs = 1 then { For cnt = 1 to TotalTrades { If Ord(cnt, VAL_SYMBOL) = Symbol then { CurrentPairTrades = CurrentPairTrades+1; } } } Else { CurrentPairTrades = TotalTrades; } // MODIFY ORDER ========================================= If EnableTS = 1 then { If CurrentPairTrades > 0 then { For cnt = 1 to TotalTrades { If Ord(cnt, VAL_SYMBOL) = Symbol then { If Ord(cnt, VAL_TYPE) = OP_SELL and Ord(cnt, VAL_STOPLOSS) > Bid+(EntryPips+DirPips)*Point then { ModifyOrder( Ord(cnt, VAL_TICKET), Ord(cnt, VAL_OPENPRICE), Bid+(EntryPips+DirPips)*Point, Bid-TakeProfit*Point, SellColor); } If Ord(cnt, VAL_TYPE) = OP_BUY and Ord(cnt, VAL_STOPLOSS) < Ask-(EntryPips+DirPips)*Point then { ModifyOrder( Ord(cnt, VAL_TICKET), Ord(cnt, VAL_OPENPRICE), Ask-(EntryPips+DirPips)*Point, Ask+TakeProfit*Point, BuyColor); } } } } } // CLOSE ORDER ========================================== If CurrentPairTrades > 0 then { For cnt = 1 to TotalTrades { If Ord(cnt, VAL_SYMBOL) = Symbol then { If Ord(cnt, VAL_TYPE) = OP_SELL then { If ( Close[0]-Low[0] >= EntryPips*Point and Open[0]-Low[0] >= TailPips*Point and Close[0]-Open[0] >= DirPips*Point and Close[0]-Open[0] <= EntryPips*Point ) or Hour = 23 then { CloseOrder( Ord(cnt, VAL_TICKET), Ord(cnt, VAL_LOTS), Ord(cnt, VAL_CLOSEPRICE), Slippage, SellColor); If MultiPairs = 1 then CurrentPairTrades = CurrentPairTrades-1; } } If Ord(cnt, VAL_TYPE) = OP_BUY then { If ( High[0]-Close[0] >= EntryPips*Point and High[0]-Open[0] >= TailPips*Point and Open[0]-Close[0] >= DirPips*Point and Open[0]-Close[0] <= EntryPips*Point ) or Hour = 23 then { CloseOrder( Ord(cnt, VAL_TICKET), Ord(cnt, VAL_LOTS), Ord(cnt, VAL_CLOSEPRICE), Slippage, BuyColor); If MultiPairs = 1 then CurrentPairTrades = CurrentPairTrades-1; } } } } } // SET ORDER ============================================ If CurrentPairTrades < 1 and Ask-Bid <= MinSpread*Point and FreeMargin >= MinMargin and Hour < 18 and DirPips > 0 then { If High[0]-Close[0] >= EntryPips*Point and High[0]-Open[0] >= TailPips*Point and Open[0]-Close[0] >= DirPips*Point and Open[0]-Close[0] <= EntryPips*Point then { SetOrder( OP_SELL, LotMM, Bid, Slippage, Bid+(EntryPips+DirPips)*Point, Bid-TakeProfit*Point, SellColor); Exit; } If Close[0]-Low[0] >= EntryPips*Point and Open[0]-Low[0] >= TailPips*Point and Close[0]-Open[0] >= DirPips*Point and Close[0]-Open[0] <= EntryPips*Point then { SetOrder( OP_BUY, LotMM, Ask, Slippage, Ask-(EntryPips+DirPips)*Point, Ask+TakeProfit*Point, BuyColor); Exit; } };