/*[[ Name := 4HR VTrader Author := FAB4X Link := http://www.FAB4X.com Notes := Use on 4HR charts Lots := 1.00 Stop Loss := 0 Take Profit := 0 Trailing Stop := 0 ]]*/ Define: StartHour(0),StartMinute(0),Slippage(5),MM(0),Risk(7.5); Var: cnt(0),Opentrades(0),lotsi(0); var: trend(""); var: vTime(0),mtsbC(0),mtssC(0); VAR: vol1(0),vol2(0); /* if Period != 240 then { Comment("This expert is for 4HR Charts"); Exit; } */ //If (DayOfWeek <2 or DayOfWeek >6 or hour <= 8 or hour >21) then exit; if Curtime - LastTradeTime < 5 then exit; vol1=volume[1]; vol2=volume[2]; if vol1vol2 then { trend ="SHORT"; }else{ if vol1=vol2 then { trend ="FLAT"; } } } comment("VOLUME TREND DIRECTION IS ",trend,"\nTime=",TimeToStr(curtime)); ////////////////////////////////////////////////// ///////////// Manage multiple trades ///////////// ////////////////////////////////////////////////// Opentrades=0; For cnt=1 to TotalTrades Begin If OrderValue(cnt,Val_Symbol)=Symbol then { Opentrades=Opentrades+1; }; End; ////////////////////////////////////////////////// ///////////// Money Manager ///////////// ////////////////////////////////////////////////// if mm<>0 then Lotsi=Ceil(Balance*risk/10000)/10 else Lotsi=Lots; ///* //if Opentrades =! 0 then //{ for cnt=1 to TotalTrades { If Ord(cnt,VAL_TYPE)=OP_BUY and Ord(cnt,VAL_SYMBOL)=Symbol then { If CurTime-OrderValue(cnt,VAL_OPENTIME) >= 14400 then { CloseOrder(OrderValue(cnt,VAL_TICKET),Ord(cnt,VAL_LOTS),bid,0,BlueViolet); // Exit; }; }; If Ord(cnt,VAL_TYPE)=OP_SELL and Ord(cnt,VAL_SYMBOL)=Symbol then { If CurTime-OrderValue(cnt,VAL_OPENTIME) >= 14400 then { CloseOrder(OrderValue(cnt,VAL_TICKET),Ord(cnt,VAL_LOTS),ask,0,Violet); // Exit; }; }; }; //if (Hour>=StartHour and Minute>=StartMinute) then //{ if vol1=vol2 then exit; if opentrades < 1 then { //if vTime != Time[0] then //{ IF vol1vol2 THEN { SetOrder(OP_SELL,Lotsi,open,slippage,0,0,Red); // vTime = Time[0]; Exit; } } //} //}