/*[[ Name := Fib retrace cross Trader (EUR 30 minute chart, maybe others?) Author := Smoky Link := Notes := Update on every tick := Yes Enable Alerts := Yes Disable alert once hit := No Lots := 1 Stop Loss := 30 Take Profit := 1000 Trailing Stop := 999 ]]*/ vars: Slippage(2),MATrendPeriod(60);//not used defines: CountBars(2),CountPeriods(2),FRV(16);//not used vars: sl(0),tp(0); defines: Y(0),Z(0),W(0),K(0);//not used vars:p(0),q(0); var:mode(0); var: s(0);//not used var: b(0); var: e(0); var: g(0);//not used var: m(0); var: n(0); var: d(0);//not used var: f(0);//not used var: i(0);//not used var: j(0);//not used vars : cnt(0),first(0),Lotsa(0); Lotsa= Balance/Balance;//10000; If Bars<100 or TakeProfit<10 then Exit; If IsIndirect(Symbol)=TRUE then Exit; //p=TrailingStop*Point;//BUY p=5*Point+2.5*iATR(10,1);//BUY //q=TrailingStop*Point;//SELL q=5*Point+2.5*iATR(10,1);//SELL s=3*Point; b=Low[Lowest(MODE_LOW,1,48)]; m=Low[Lowest(MODE_LOW,1,3)]; e=High[Highest(MODE_HIGH,1,48)]; n= High[Highest(MODE_HIGH,1,3)]+3*Point; If TotalTrades<1 and CurTime - LastTradeTime >7200 then { sl=m+StopLoss*Point-s; If Bid>(b+(e-b)*0.4) and Bid<(b+(e-b)*0.7) and iMA(9,MODE_EMA,3)> iMA(18,MODE_EMA,3) and iMA(9,MODE_EMA,1)< iMA(18,MODE_EMA,1) and iATR(15,1)<25*Point and iMA(100,MODE_EMA,1)< iMA(100,MODE_EMA,2)and iSAR(0.02,0.2,0)>Bid then { SetOrder(OP_SELLSTOP,Lotsa,m-s,Slippage,sl,m-TakeProfit*Point-s,Red); Exit;}; sl=n-StopLoss*Point+s; If Bid<(b+(e-b)*0.7) and Bid>(b+(e-b)*0.2) and iMA(9,MODE_EMA,3)< iMA(18,MODE_EMA,3) and iMA(9,MODE_EMA,1)> iMA(18,MODE_EMA,1) and iATR(15,1)<25*Point and iMA(100,MODE_EMA,1)> iMA(100,MODE_EMA,2)and iSAR(0.02,0.2,0)(p) then { If OrderValue(cnt,VAL_STOPLOSS)<(Bid-p) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE), Bid-p,OrderValue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; If mode=OP_SELL then // { If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(q) then { If OrderValue(cnt,VAL_STOPLOSS)>(Ask+q) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE), Ask+q,OrderValue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; If mode>OP_SELL then // { // check how long it exists in the trading terminal // time is counted in seconds: // 10 minutes = 600 seconds, 30 minutes = 1800, 1 hour = 3600, 1 day = 86400 If (CurTime-OrderValue(cnt,VAL_OPENTIME))>7200 then { DeleteOrder(OrderValue(cnt,VAL_TICKET),RED); Exit; }; }; If mode>OP_BUY then // this is a waiting order! { // check how long it exists in the trading terminal // time is counted in seconds: // 10 minutes = 600 seconds, 30 minutes = 1800, 1 hour = 3600, 1 day = 86400 If (CurTime-OrderValue(cnt,VAL_OPENTIME))>7200 then { DeleteOrder(OrderValue(cnt,VAL_TICKET),RED); Exit; }; }; };