#
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Home
Forex Forum
+ Add Script
Metastock
Expert Advisors
Explorations
Indicators
Trading Systems
Metatrader
MQL Experts
MQL Indicators
MQ4 Experts
MQ4 Indicators
MQ4 Scripts
Tradestation
Functions
Indicators
PaintBars
ShowMe
Trading Systems
Amibroker
Commentaries
Explorations
Functions
Indicators
Trading Systems
Contact us
Newsletter
Group: Metatrader MQ4 Experts
Title: FAB4X 3*7*21 System
Description:
FAB4X 3*7*21 System, RUN ONLY ON A 15MIN CHART.GBP/USD
/*[[ Name := FAB4X 3*7*21 System Author := Fabio Lio Copyright © DEC 2004 Link := RUN ONLY ON A 15MIN CHART.GBP/USD BEST Lots := 1.00 Stop Loss := 0 Take Profit := 50 Trailing Stop := 15 ]]*/ Input : FastPeriod(7), SlowPeriod(21); Input : FastPeriodX(3), SlowPeriodX(21); Input : FastPeriodE(3), SlowPeriodE(7); Defines : risk(10),mm(1),settime(15),endtime(23); Variable : shift(0); Variable : iMASlowPrevious(0), iMaSlowCurrent(0), iMaFastPrevious(0), iMaFastCurrent(0); Variable : iMASlowPreviousE(0), iMaSlowCurrentE(0), iMaFastPreviousE(0), iMaFastCurrentE(0); Variable : iMASlowPreviousX(0), iMaSlowCurrentX(0), iMaFastPreviousX(0), iMaFastCurrentX(0); Variable : val1(0), val2(0); Variables : EACross1(0),EACross2(0),Current(0),cnt(0); Var : TR(0),TR1(0),TR2(0),TRPREV(0); var: myFileName(" "),myFile(0); var: alertTime(""); var: OrderText(""),AlertText(""); var: lotsi(0); var: vMode11(0); var: vMode12(0); myFileName=Symbol + Period + " FAB4X3721"; //MONEY MANAGEMENT if mm<>0 then lotsi=Ceil(Equity*risk/10000)/10 else lotsi=lots; vMode11 = iCustom("iTrend",0,0,0,20,2,5,MODE_FIRST,0); vMode12 = iCustom("iTrend",0,0,0,20,2,5,MODE_SECOND,0); //IF bars<250 then exit; If (DayOfWeek <2 or DayOfWeek >6 or hour < 15 or hour >22) then exit; if TotalTrades < 1 then { iMaSlowPrevious = iMAEx(SlowPeriod, MODE_EMA, 0, PRICE_CLOSE, 1); iMaSlowCurrent = iMAEx(SlowPeriod, MODE_EMA, 0, PRICE_CLOSE, 0); iMaFastPrevious = iMAEx(FastPeriod, MODE_EMA, 0, PRICE_CLOSE, 1); iMaFastCurrent = iMAEx(FastPeriod, MODE_EMA, 0, PRICE_CLOSE, 0); iMaSlowPreviousE = iMAEx(SlowPeriodE, MODE_EMA, 0, PRICE_CLOSE, 1); iMaSlowCurrentE = iMAEx(SlowPeriodE, MODE_EMA, 0, PRICE_CLOSE, 0); iMaFastPreviousE = iMAEx(FastPeriodE, MODE_EMA, 0, PRICE_CLOSE, 1); iMaFastCurrentE = iMAEx(FastPeriodE, MODE_EMA, 0, PRICE_CLOSE, 0); iMaSlowPreviousX = iMAEx(SlowPeriodX, MODE_EMA, 0, PRICE_CLOSE, 1); iMaSlowCurrentX = iMAEx(SlowPeriodX, MODE_EMA, 0, PRICE_CLOSE, 0); iMaFastPreviousX = iMAEx(FastPeriodX, MODE_EMA, 0, PRICE_CLOSE, 1); iMaFastCurrentX = iMAEx(FastPeriodX, MODE_EMA, 0, PRICE_CLOSE, 0); If iMaFastPrevious
iMASlowCurrent and vMode11= 1 and vMode12= 0 then { myFile = FileOpen(myFileName,","); FileWrite(myFile, "It is a good time to buy ",symbol,"@",OPEN + hour +":"+ Minute + ":" + Seconds +" GMT+2"); FileClose(myFile); Alert(Month,"/",Day," ",alertTime," Buy ",Symbol," @",OPEN, " ", AlertText); SetOrder(OP_BUY,lotsi,OPEN,3,0,OPEN+TakeProfit*Point,Green); }; If iMaFastPreviousX>iMaSlowPreviousX and iMaFastCurrentX
iMaSlowPreviousE and iMaFastCurrentE
iMaSlowPrevious and iMaFastCurrent
iMASlowCurrentX Then { Alert(Month,"/",Day," ",alertTime," EXIT NOW ",Symbol," @",priceask, " ", AlertText); }; If iMaFastPreviousE
iMASlowCurrentE Then { Alert(Month,"/",Day," ",alertTime," TRADE NOW GOING LONG ",Symbol," @",priceask, " ", AlertText); }; }; ///////////////Allow For Attachment to more than one Chart If TotalTrades > 0 then { Current = 0; for cnt = 1 to TotalTrades Begin If Not Ord(cnt,VAL_SYMBOL) = Symbol then { Current = Current+1; // if this trade is NOT in the currency pair that the advisor is attached to than add 1 to Current } else { if Ord(cnt,VAL_SYMBOL) = Symbol then { iMaSlowPreviousE = iMAEx(SlowPeriodE, MODE_EMA, 0, PRICE_CLOSE, 1); iMaSlowCurrentE = iMAEx(SlowPeriodE, MODE_EMA, 0, PRICE_CLOSE, 0); iMaFastPreviousE = iMAEx(FastPeriodE, MODE_EMA, 0, PRICE_CLOSE, 1); iMaFastCurrentE = iMAEx(FastPeriodE, MODE_EMA, 0, PRICE_CLOSE, 0); If iMaFastPreviousX>iMaSlowPreviousX and iMaFastCurrentX
iMASlowCurrentX Then { if Ord(cnt,VAL_TYPE) = OP_SELL then { CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),priceask,3,Red); exit; }; }; }; }; End; If Current = TotalTrades then // There are NO open positions in the currency pair that the advisor is attached to { iMaSlowPrevious = iMAEx(SlowPeriod, MODE_EMA, 0, PRICE_CLOSE, 1); iMaSlowCurrent = iMAEx(SlowPeriod, MODE_EMA, 0, PRICE_CLOSE, 0); iMaFastPrevious = iMAEx(FastPeriod, MODE_EMA, 0, PRICE_CLOSE, 1); iMaFastCurrent = iMAEx(FastPeriod, MODE_EMA, 0, PRICE_CLOSE, 0); iMaSlowPreviousE = iMAEx(SlowPeriodE, MODE_EMA, 0, PRICE_CLOSE, 1); iMaSlowCurrentE = iMAEx(SlowPeriodE, MODE_EMA, 0, PRICE_CLOSE, 0); iMaFastPreviousE = iMAEx(FastPeriodE, MODE_EMA, 0, PRICE_CLOSE, 1); iMaFastCurrentE = iMAEx(FastPeriodE, MODE_EMA, 0, PRICE_CLOSE, 0); iMaSlowPreviousX = iMAEx(SlowPeriodX, MODE_EMA, 0, PRICE_CLOSE, 1); iMaSlowCurrentX = iMAEx(SlowPeriodX, MODE_EMA, 0, PRICE_CLOSE, 0); iMaFastPreviousX = iMAEx(FastPeriodX, MODE_EMA, 0, PRICE_CLOSE, 1); iMaFastCurrentX = iMAEx(FastPeriodX, MODE_EMA, 0, PRICE_CLOSE, 0); If iMaFastPrevious
iMASlowCurrent and vMode11= 1 and vMode12= 0 Then { myFile = FileOpen(myFileName,","); FileWrite(myFile, "It is a good time to buy ",symbol,"@",OPEN + hour +":"+ Minute + ":" + Seconds +" GMT+2"); FileClose(myFile); Alert(Month,"/",Day," ",alertTime," Buy ",Symbol," @",OPEN, " ", AlertText); SetOrder(OP_BUY,lotsi,OPEN,3,0,OPEN+TakeProfit*Point,GREEN); If iMaFastPreviousX
iMASlowCurrentX Then { Alert(Month,"/",Day," ",alertTime," EXIT NOW ",Symbol," @",priceask, " ", AlertText); }; If iMaFastPreviousE
iMASlowCurrentE Then { Alert(Month,"/",Day," ",alertTime," TRADE NOW GOING SHORT ",Symbol," @",priceask, " ", AlertText); }; If iMaFastPrevious>iMaSlowPrevious and iMaFastCurrent
iMASlowCurrentX Then { Alert(Month,"/",Day," ",alertTime," EXIT NOW ",Symbol," @",priceask, " ", AlertText); }; If iMaFastPreviousE
iMASlowCurrentE Then { Alert(Month,"/",Day," ",alertTime," TRADE NOW GOING LONG ",Symbol," @",priceask, " ", AlertText); }; }; }; ///////////////End Allow For Attachment to more than one Chart ////////////////////////////////////////////////////////// /////////////////////////Trailing Stop Code ///////////////////// ////////////////////////////////////////////////////////// If TotalTrades > 0 then { for cnt = 1 to TotalTrades Begin If Ord(cnt,VAL_TYPE)=OP_BUY then { /////////////////// If Ord(cnt,VAL_SYMBOL)= Symbol then { If Ord(cnt,VAL_OPENPRICE) + TrailingStop*Point < Bid Then { If Ord(cnt,VAL_STOPLOSS)<(Bid-TrailingStop*Point) then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE), Bid-TrailingStop*Point,Ord(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; If Ord(cnt,VAL_TAKEPROFIT) = 0 Then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE), Ord(cnt,VAL_OPENPRICE)-StopLoss*Point,Ord(cnt,VAL_OPENPRICE)+TakeProfit*Point,Red); Exit; }; }; };// End of BUY If Ord(cnt,VAL_TYPE)=OP_SELL then { /////////////////// If Ord(cnt,VAL_SYMBOL)= Symbol then { If Ord(cnt,VAL_OPENPRICE) - TrailingStop*Point > Ask Then { If Ord(cnt,VAL_STOPLOSS)>(Ask+TrailingStop*Point) then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE),Ask+TrailingStop*Point, Ord(cnt,VAL_TAKEPROFIT),White); Exit; }; }; If Ord(cnt,VAL_TAKEPROFIT) = 0 Then { ModifyOrder(Ord(cnt,VAL_TICKET),Ord(cnt,VAL_OPENPRICE), Ord(cnt,VAL_OPENPRICE)+StopLoss*Point,Ord(cnt,VAL_OPENPRICE)-TakeProfit*Point,Red); Exit; }; }; };//End of Sell End; }; };
Author/Source:
Fabio Lio
Forex Directory
|
Free Forex Strategies
|
Forex Trading Systems
|
Privacy
|
Disclaimer
|
Contact