//////////////////////////////////////////////////////// // Free Momods Night Scalper // // modded by pip.digger // // // // based on // // // // Momods_Night_Scalper_V3.02_Basic_MMfix // // Coded by Momods @ worldwide-invest.org // // April 29, 2013 // //////////////////////////////////////////////////////// // If you make money from this EA // // please make donnation to my paypal Account // // mohddisi@yahoo.com // //////////////////////////////////////////////////////// //V1.3 (March 17, 2013) - Added second condition for Fractals signal // - Added MA Slope filter // - Added settings internally // //V1.4 (March 23, 2013) - Fixed a bug in displaying Open/Close hours // - No need to add pair suffix // - Added code to generate master magic number for all pairs based on account number // - Faster back tests // - hide EA name in comments from broker (enter your own) // - Option to hide SL/TP from broker. Highly dangerous if you are not using VPS. // - Now you can see total profit (loss) for each pair on the display // - Revised settings for several pairs based on optimization // //V2.0 (March 31, 2013) - Fixed a bug in calculating trading times for friday // - Added BB to be used either as Signal or filter. // - Added trade spacing time filter (When a trade closes in loss, EA will wait x minutes before opening a same type trade). // - Modified settings for EURCAD, EURGBP, and USDCAD. //V2.1 (March 31, 2013) - Fixed a bug in calculating trade pause //V2.2 (April 2, 2013) - Fixed another bug in session display. // //V2.21 (April 14, 2013) - Added Max Spread to externals // - Fixed display bug // //V3.0 (April 21, 2013) - Added Auto-Timing (EA will determine your broker's GMT Offset automatically). // - Added Daylight Saving Timing (DST) for back testing // - Added maximo's Fractal Level indicator // - Renamed several parameters to remove any confusion // - Added second option to puase trades on loss based on pips from last loss (good for trading on price charts....renko...range..) // - Added RSI indicator as signal/filter //V3.01 (April 24, 2013) - Limited Auto timing just to get correct GMT Offset. Use manual GMT offset for trading. //V3.02 (April 29, 2013) - Fixed default mode for MA that affected EURUSD settings. // - Changed default max spread=0 which prevented internal settings from being used. // - LAST FREE VERSION BY MOMODS // //V3.02_MMfix (May 23, 2013) - Fixed money management to consider account currency and quote currency. // //v0.9.0 (May 31, 2013) - Replaced magic number generator // - Revised EA parameter list // - Corrected MA_Dist signal // - Updated HUD // - HUD now shows in visual backtest // - Speedups for backtesting // - TakeProfit, Friday_Hour, and Risk are now a default parameters, // Risk = 0.0 means use defaults // - Unified Basic and Pro versions // - New PRO parameter section, disable AutoConfig to use manual parameters in PRO section //v0.9.1 (May 31, 2013) - Updated trading hours code to account for fractional hours, and DST changes thruout the trading year // - All trading hours are now specified as doubles = fractional hours // - Now allows correct backtests with DST adjusted history data // - Changed parameter UseDST to HistoryUsesDST //v0.9.2 (Apr 1, 2013) - Bugfix for backtesting using HistoryUsesDST #property copyright "Copyright © 2013, Momods, pip.digger" #property link "http://worldwide-invest.org/" /*#import "Wininet.dll" int InternetOpenA(string, int, string, string, int); int InternetConnectA(int, string, int, string, string, int, int, int); int HttpOpenRequestA(int, string, string, int, string, int, string, int); int InternetOpenUrlA(int, string, string, int, int, int); int InternetReadFile(int, string, int, int& OneInt[]); int InternetCloseHandle(int); #import*/ #include <WinUser32.mqh> #import "kernel32.dll" void GetSystemTime(int& SYSTEMTIME[]); #import // EA name and version string EA_Name= "Free Momods Night Scalper"; string EA_Version = "0.9.2"; // externals extern string EA_Configuration = "==== EA Configuration ===="; extern string EA_Comment = ""; extern int Magic = 0; extern string MagicKey = ""; extern string TimeSettings = "==== Time settings ===="; extern bool AutoGMT = true; extern int GMT_Offset = 0; extern bool HistoryUsesDST = false; extern bool TradeOnFriday = false; extern string MoneyManagement = "==== Money Management ===="; extern double LotSize = 0.0; extern double Risk = 0.0; extern string TradeSettings = "==== Trade settings ===="; extern bool New_Trade = true; extern double Max_Spread = 0.0; extern int Slippage = 3; extern bool Hide_SL_TP = false; extern bool Allow_Second_Open_Trade = false; extern double Distance = 12.0; extern double Lot_Factor = 0.5; extern bool Trade_Pause_On_Loss = false; extern string Pause_Comment = "Pause type: 1= Use Minutes, 2= Use Pips"; extern int Pause_Type = 1; extern int Trade_Pause_Minutes = 60; extern double Trade_Pause_Pips = 20.0; extern string EyeCandy = "==== Eye Candy ===="; extern bool Show_Fractal_Levels = false; extern string ProSettings = "==== PRO Settings ===="; extern bool AutoConfig = true; extern string STPSL="----------------------"; extern double TakeProfit = 60.0; extern double StopLoss = 50.0; extern string SHRS="----------------------"; extern double GMT_Open_Hour = 20; extern double GMT_Close_Hour = 23; extern double GMT_Friday_Hour = 15; extern string SCCI="----------------------"; extern bool Use_CCI = false; extern int CCI_Period = 10; extern double CCI_Entry = 200; extern double CCI_Exit = 140; extern string SWPR="----------------------"; extern bool Use_WPR = true; extern int WPR_Period = 10; extern double WPR_Entry = 91; extern double WPR_Exit = 40; string SRSI="----------------------"; bool Use_RSI = false; int RSI_Period = 70; double RSI_Entry = 50; extern string SFractals="----------------------"; extern bool Use_Fractals = true; extern double MidFractalDist = 5; extern double OppositFractalDist = 10; string SMADist="----------------------"; bool Use_MA_Dist = false; double MA_Dist_Period = 4; string Mode0 = "0= Simple, 1= Exponential, 2= Smoothed, 3= Linear Weighted"; double MA_Dist_Mode = 1; double Dist_to_MA = 4; extern string SMA="----------------------"; extern bool Use_MA1 = false; extern int MA_Period1 = 75; string Mode1 = "0= Simple, 1= Exponential, 2= Smoothed, 3= Linear Weighted"; int MA_Mode1 = 2; extern bool Use_MA2 = false; extern int MA_Period2 = 19; string Mode2 = "0= Simple, 1= Exponential, 2= Smoothed, 3= Linear Weighted"; int MA_Mode2 = 2; extern bool Use_MA2_Slope = false; extern double MA_Slope = 1; string SBB="----------------------"; bool Use_BB = false; int BB_Period = 10; int BB_Dev = 2; int BB_Range = 12; int BB_Penetration = 2; bool Use_BB_Direction = false; string S11="---------Global Variables---------------"; // globals bool Trade = false; datetime Last_Time; double Lot; double PointValue; double LastUpFractal,LastDownFractal; double midFractal; int SpreadSampleSize = 10; double Spread[0]; string Session=""; int CCI_Buy_Sig; int CCI_Sell_Sig; int WPR_Buy_Sig; int WPR_Sell_Sig; int MA_Buy_Sig1; int MA_Sell_Sig1; int MA_Buy_Sig2; int MA_Sell_Sig2; int Fractals_Buy_Sig; int Fractals_Sell_Sig; int CCI_Exit_Buy_Sig; int CCI_Exit_Sell_Sig; int WPR_Exit_Buy_Sig; int WPR_Exit_Sell_Sig; int MA_Slope_Buy_Sig; int MA_Slope_Sell_Sig; int BB_Buy_Sig; int BB_Sell_Sig; int Trade_Pause_Buy_Sig; int Trade_Pause_Sell_Sig; int MA_Dist_Buy_Sig; int MA_Dist_Sell_Sig; int RSI_Buy_Sig; int RSI_Sell_Sig; double CCI_1,WPR_1, MA_1_1, MA_1_2,MA_2_1,MA_2_2,BB_U_1,BB_U_2,BB_U_3,BB_L_1,BB_L_2,BB_L_3,MA_3_1, RSI_1; datetime bt = 0; double Open_Hour, Close_Hour, Friday_Hour; int init() { //----------------------------------- Check if min. 1 signal is activated ----------------------------// if(!Use_CCI && !Use_WPR && !Use_Fractals) { Print("You must use at least one signal (CCI, WPR, or Fractals)"); if(IsTesting()||IsOptimization()) { New_Trade = false; // switch off trading in BT if no signal is chosen } else { Comment("You must use at least one signal (CCI, WPR, or Fractals)! Aborting..."); MessageBox("You must use at least one signal (CCI, WPR, or Fractals)! Aborting...", "Please use at least one signal", MB_OK|MB_ICONERROR); while(true) Sleep(1000); } } //----------------------------------- get GMT offset ----------------------------------------------------// if(AutoGMT) if(IsTesting()||IsOptimization()) { AutoGMT = false; Print("WARNING: AutoGMT does not work in backtester! Using manual GMT_Offset = ", GMT_Offset); } else if(!IsDllsAllowed()) { Comment("Please enable DLLs for AutoGMT to work! Aborting..."); MessageBox("Please enable DLLs for AutoGMT to work! Aborting...", "Please enable DLLs", MB_OK|MB_ICONERROR); while(true) Sleep(1000); } else GMT_Offset = GetGMT_Offset(); SetTradeHrs(); //--------------------------------- initialize some globals -----------------------------------------------// PointValue = GetPointValue(); //--------------------------------- Set Magic Number ------------------------------------------------------// if(Magic <= 0 && StringLen(MagicKey) == 0 && !(IsTesting() || IsOptimization())) if(MessageBox("Please use parameter MagicKey to create unique Magic numbers which cannot be backtracked by your br0ker. Press OK to continue without MagicKey, or Cancel to cancel EA operation.","MagicKey",MB_OKCANCEL|MB_ICONQUESTION)==IDCANCEL) while(true) Sleep(1000); if(Magic <= 0) Magic = AutoMagic(); //--------------------------------- Set Defaults ---------------------------------------------------------// if(AutoConfig) SetDefaults(); return (0); } // end init() int deinit() { return (0); } // end deinit() int start() { int i; double x,y; // run every new bar openening if(bt != Time[0]) { // check every week if GMT and / or DST status has changed if(TimeDayOfWeek(bt) > 4 && DayOfWeek() < 2) { if(AutoGMT) GMT_Offset = GetGMT_Offset(); SetTradeHrs(); } bt = Time[0]; } //////////////////////////////////// Trade Timing /////////////////////////////////////////////// Trade = true; x = Hour() + Minute()/60.0; // Friday trading rules if(!TradeOnFriday && TimeDayOfWeek(TimeCurrent()-GMT_Offset*3600) == 5) Trade = false; // ERROR: does not consider DST if(TradeOnFriday && DayOfWeek() == 5 && x > Friday_Hour) Trade = false; // Normal trading day rules if (Open_Hour < Close_Hour && (x<Open_Hour || x>=Close_Hour)) Trade = false; if (Open_Hour > Close_Hour && x<Open_Hour && x>=Close_Hour) Trade = false; // holiday season rules if (Month()==12 && Day()>22) Trade = false; // ERROR: goes by server time (not GMT time), does not consider DST if (Month()==1 && Day()<5) Trade = false; // ERROR: goes by server time (not GMT time), does not consider DST //////////////////// Calculate Average Spread ///////////////////// if (!IsTesting() && !IsOptimization()) Spread(Ask-Bid); //////////////////////////// Add Display (HUD & fractal levels indi) ///////////////////////////// if(!(IsTesting()||IsOptimization()) || IsVisualMode()) { if(Trade && MyRealOrdersTotal(Magic)==0 && !Allow_Second_Open_Trade && Spread()<Max_Spread*PointValue && (Ask-Bid)<Max_Spread*PointValue) Session="Trade Session Open .. Waiting for trades"; if(Trade && MyRealOrdersTotal(Magic)==0 && Spread()<Max_Spread*PointValue && (Ask-Bid)<Max_Spread*PointValue) Session="Trade Session Open .. Waiting for trades"; if(Trade && MyRealOrdersTotal(Magic)==0 && (Spread()>Max_Spread*PointValue || (Ask-Bid)>Max_Spread*PointValue)) Session="Trade Session Open .. Spread is High .. Trading Halted"; if(Trade && MyRealOrdersTotal(Magic)>0 && (Spread()>Max_Spread*PointValue || (Ask-Bid)>Max_Spread*PointValue)) Session="Trade Session Open .. Waiting to exit trades .. Trading Halted"; if(Trade && MyRealOrdersTotal(Magic)>0 && (Spread()<Max_Spread*PointValue || (Ask-Bid)<Max_Spread*PointValue)) Session="Trade Session Open .. Waiting to exit trades"; if(!Trade && MyRealOrdersTotal(Magic)==0) Session="Trade Session Closed"; if(!Trade && MyRealOrdersTotal(Magic)>0) Session="Trade Session Closed .. Waiting to exit trades"; Display(); if(Show_Fractal_Levels) iCustom(NULL,0,"Fractal_Levels",MidFractalDist,OppositFractalDist,0,0); } ///////////////////////////// Indicator(s) ///////////////////////// if (Trade || OrdersTotal()>0) { if (Use_CCI) CCI_1 = iCCI(NULL,0,CCI_Period,PRICE_CLOSE,0); if (Use_WPR) WPR_1 = iWPR(NULL,0,WPR_Period,0); if (Use_MA1) { MA_1_1 = iMA(NULL,0,MA_Period1,0,MA_Mode1,PRICE_CLOSE,1); MA_1_2 = iMA(NULL,0,MA_Period1,0,MA_Mode1,PRICE_CLOSE,2); } if (Use_MA2 || Use_MA2_Slope) { MA_2_1 = iMA(NULL,0,MA_Period2,0,MA_Mode2,PRICE_CLOSE,1); MA_2_2 = iMA(NULL,0,MA_Period2,0,MA_Mode2,PRICE_CLOSE,2); } if (Use_MA_Dist) MA_3_1 = iMA(NULL,0,MA_Dist_Period,0,MA_Dist_Mode,PRICE_CLOSE,1); if (Use_BB) { BB_L_1 = iBands(NULL,0,BB_Period,BB_Dev,0,PRICE_CLOSE,MODE_LOWER,0); BB_L_2 = iBands(NULL,0,BB_Period,BB_Dev,0,PRICE_CLOSE,MODE_LOWER,1); BB_L_3 = iBands(NULL,0,BB_Period,BB_Dev,0,PRICE_CLOSE,MODE_LOWER,2); BB_U_1 = iBands(NULL,0,BB_Period,BB_Dev,0,PRICE_CLOSE,MODE_UPPER,0); BB_U_2 = iBands(NULL,0,BB_Period,BB_Dev,0,PRICE_CLOSE,MODE_UPPER,1); BB_U_3 = iBands(NULL,0,BB_Period,BB_Dev,0,PRICE_CLOSE,MODE_UPPER,2); } if (Use_RSI) RSI_1 = iRSI(NULL,0,RSI_Period,PRICE_CLOSE,0); if (Use_Fractals) { for(i=1;i<Bars;i++) { x=iFractals(NULL,0,MODE_UPPER,i); if(x!=0.0) { LastUpFractal=x; break; } } for(i=1;i<Bars;i++) { x=iFractals(NULL,0,MODE_LOWER,i); if(x!=0.0) { LastDownFractal=x; break; } } midFractal=(LastUpFractal+LastDownFractal)/2.0; } // end UseFractals } //////////////////////////////////// Enter Trade Signals ///////////////////////////////////////// CCI_Buy_Sig = 0; CCI_Sell_Sig = 0; WPR_Buy_Sig = 0; WPR_Sell_Sig = 0; MA_Buy_Sig1 = 0; MA_Sell_Sig1 = 0; MA_Buy_Sig2 = 0; MA_Sell_Sig2 = 0; MA_Slope_Buy_Sig = 0; MA_Slope_Sell_Sig = 0; Fractals_Buy_Sig = 0; Fractals_Sell_Sig = 0; BB_Buy_Sig = 0; BB_Sell_Sig = 0; Trade_Pause_Buy_Sig = 1; Trade_Pause_Sell_Sig = 1; MA_Dist_Buy_Sig = 0; MA_Dist_Sell_Sig = 0; RSI_Buy_Sig = 0; RSI_Sell_Sig = 0; if(Use_CCI) { if(CCI_1<-CCI_Entry) CCI_Buy_Sig=1; if(CCI_1>CCI_Entry) CCI_Sell_Sig=1; // maybe change into "else if" on this line (buy & sell can't be triggered at the same time) } else {CCI_Buy_Sig=1;CCI_Sell_Sig=1;} if(Use_WPR) { if(WPR_1<-WPR_Entry) WPR_Buy_Sig=1; if(WPR_1>-100+WPR_Entry) WPR_Sell_Sig=1; } else {WPR_Buy_Sig=1;WPR_Sell_Sig=1;} if(Use_MA1) { if(MA_1_1>MA_1_2) MA_Buy_Sig1=1; if(MA_1_1<MA_1_2) MA_Sell_Sig1=1; } else {MA_Buy_Sig1=1; MA_Sell_Sig1=1;} if(Use_MA2) { if(MA_2_1>MA_2_2) MA_Buy_Sig2=1; if(MA_2_1<MA_2_2) MA_Sell_Sig2=1; } else {MA_Buy_Sig2=1; MA_Sell_Sig2=1;} if(Use_MA2_Slope) { if(MA_2_1-MA_2_2 >= MA_Slope*PointValue) MA_Slope_Buy_Sig=1; if(MA_2_2-MA_2_1 >= MA_Slope*PointValue) MA_Slope_Sell_Sig=1; } else {MA_Slope_Buy_Sig=1; MA_Slope_Sell_Sig=1;} if(Use_Fractals) { x = MidFractalDist*PointValue; // NOTE: MidFractalDist etc.. can also be adjusted in init(). then, no need to re-calculate here everytime! y = OppositFractalDist*PointValue; if(Ask<midFractal-x && Ask<LastUpFractal-y) Fractals_Buy_Sig=1; if(Bid>midFractal+x && Bid>LastDownFractal+y) Fractals_Sell_Sig=1; } else {Fractals_Buy_Sig=1; Fractals_Sell_Sig=1;} if(Use_BB) { x = BB_Range*PointValue; y = BB_Penetration*PointValue; if(!Use_BB_Direction && Ask<BB_L_1 && (BB_U_1-BB_L_1)>x && BB_L_1-Ask>=y) BB_Buy_Sig=1; if(!Use_BB_Direction && Bid>BB_U_1 && (BB_U_1-BB_L_1)>x && Bid-BB_U_1>=y) BB_Sell_Sig=1; if(Use_BB_Direction && Ask<BB_L_1 && (BB_U_1-BB_L_1)>x && BB_L_1-Ask>=y && BB_L_1>BB_L_2) BB_Buy_Sig=1; if(Use_BB_Direction && Bid>BB_U_1 && (BB_U_1-BB_L_1)>x && Bid-BB_U_1>=y && BB_U_1<BB_U_2) BB_Sell_Sig=1; } else {BB_Buy_Sig=1; BB_Sell_Sig=1;} if(Use_MA_Dist) { x = Dist_to_MA*PointValue; if(MA_3_1-Ask>=x) MA_Dist_Buy_Sig=1; if(Bid-MA_3_1>=x) MA_Dist_Sell_Sig=1; } else {MA_Dist_Buy_Sig=1; MA_Dist_Sell_Sig=1;} if(Use_RSI) { if(RSI_1>=RSI_Entry) RSI_Buy_Sig=1; if(RSI_1<=100-RSI_Entry) RSI_Sell_Sig=1; } else {RSI_Buy_Sig=1; RSI_Sell_Sig=1;} if(Trade_Pause_On_Loss) switch(Pause_Type) { case 1: if(LastClosedProfit(Magic)<0 && (Time[0]-LastClosedTime(Magic))<Trade_Pause_Minutes*60) if(LastClosedType(Magic)==0) Trade_Pause_Buy_Sig=0; else if(LastClosedType(Magic)==1) Trade_Pause_Sell_Sig=0; break; case 2: if(LastClosedType(Magic)==0 && LastClosedPrice(Magic)-Ask<Trade_Pause_Pips*PointValue) Trade_Pause_Buy_Sig=0; else if(LastClosedType(Magic)==1 && Bid-LastClosedPrice(Magic)<Trade_Pause_Pips*PointValue) Trade_Pause_Sell_Sig=0; break; } //////////////////////////////////// Exit Signals /////////////////////////////////////////////// CCI_Exit_Buy_Sig = 0; CCI_Exit_Sell_Sig = 0; WPR_Exit_Buy_Sig = 0; WPR_Exit_Sell_Sig = 0; if(Use_CCI) { if(CCI_1>CCI_Exit) CCI_Exit_Buy_Sig=1; if(CCI_1<-CCI_Exit) CCI_Exit_Sell_Sig=1; } if(Use_WPR) { if(WPR_1>-WPR_Exit) WPR_Exit_Buy_Sig=1; if(WPR_1<(-100+WPR_Exit)) WPR_Exit_Sell_Sig=1; } //////////////////////////////////// Close Trades /////////////////////////////////////////////// if(OrdersTotal()>0) { // close by signal if(Spread()<Max_Spread*PointValue && (Ask-Bid)<Max_Spread*PointValue) for(i=0; i<OrdersTotal(); i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) switch(OrderType()) { case OP_BUY: if(CCI_Exit_Buy_Sig==1 || WPR_Exit_Buy_Sig==1) CloseAll(Magic); break; case OP_SELL: if(CCI_Exit_Sell_Sig==1 || WPR_Exit_Sell_Sig==1) CloseAll(Magic); break; } // end switch } // end for // close by "hidden" SL and TP if(Hide_SL_TP) for(i=0; i<OrdersTotal(); i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) switch(OrderType()) { case OP_BUY: if(Ask-OrderOpenPrice()>=TakeProfit*PointValue || OrderOpenPrice()-Ask>=StopLoss*PointValue) OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); // close position break; case OP_SELL: if(OrderOpenPrice()-Bid>=TakeProfit*PointValue || Bid-OrderOpenPrice()>=StopLoss*PointValue) OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet); // close position break; } } // end for } // end if(OrdersTotal()>0) //////////////////////////////////// Open Trade /////////////////////////////////////////////// if(Trade) // only check if it is trade open time if(New_Trade && Time[0]!=Last_Time && (Ask-Bid)<Max_Spread*PointValue) // common prerequisite for all new OrderSelect if(CCI_Buy_Sig==1 && WPR_Buy_Sig==1 && MA_Buy_Sig1==1 && MA_Buy_Sig2==1 && MA_Slope_Buy_Sig==1 && Fractals_Buy_Sig==1 && BB_Buy_Sig==1 && Trade_Pause_Buy_Sig==1 && MA_Dist_Buy_Sig==1 && RSI_Buy_Sig==1) { // check all BUY signals if(Spread()<Max_Spread*PointValue && MyRealOrdersTotal(Magic)==0) { // check time-consuming function calls last Lot = CalculateLots(Risk); int Ticket_1 = OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, 0, 0, EA_Comment, Magic, 0, Lime); if(Ticket_1>0) { Last_Time=iTime(NULL,0,0); if(!Hide_SL_TP) ModifyAll(); } } // end check time-consuming function calls } // end check all BUY signals else if(CCI_Sell_Sig==1 && WPR_Sell_Sig==1 && MA_Sell_Sig1==1 && MA_Sell_Sig2==1 && MA_Slope_Sell_Sig==1 && Fractals_Sell_Sig==1 && BB_Sell_Sig==1 && Trade_Pause_Sell_Sig==1 && MA_Dist_Sell_Sig==1 && RSI_Sell_Sig==1) { // check all SELL signals if(Spread()<Max_Spread*PointValue && MyRealOrdersTotal(Magic)==0) { // check time-consuming function calls last Lot=CalculateLots(Risk); int Ticket_2 = OrderSend(Symbol(), OP_SELL, Lot, Bid, Slippage, 0, 0, EA_Comment, Magic, 0, Red); if(Ticket_2>0) { Last_Time=iTime(NULL,0,0); if(!Hide_SL_TP) ModifyAll(); } } // end check time-consuming function calls } // end check all SELL signals //////////////////////////////////// Second Trade /////////////////////////////////////////////// if(Allow_Second_Open_Trade) { if (MyRealOrdersTotal(Magic)==1 && Time[0]!=Last_Time && Trade_Pause_Buy_Sig==1 && Trade_Pause_Buy_Sig==1 && LastOpenType()==0 && Ask<=(LastBuyPrice()-Distance*PointValue)) { Lot=CalculateLots(Risk*Lot_Factor); Ticket_1 = OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, 0, 0, EA_Comment, Magic, 0, Lime); if (Ticket_1>0) { Last_Time=iTime(NULL,0,0); if (!Hide_SL_TP) ModifyAll(); } } else if (MyRealOrdersTotal(Magic)==1 && Time[0]!=Last_Time && Trade_Pause_Sell_Sig==1 && Trade_Pause_Sell_Sig==1 && LastOpenType()==1 && Bid>=(LastSellPrice()+Distance*PointValue)) { Lot=CalculateLots(Risk*Lot_Factor); Ticket_2 = OrderSend(Symbol(), OP_SELL, Lot, Bid, Slippage, 0, 0, EA_Comment, Magic, 0, Red); if (Ticket_2>0) { Last_Time=iTime(NULL,0,0); if (!Hide_SL_TP) ModifyAll(); } } } // end Allow_Second_Open_Trade // Double check to make sure all trades have TP and SL // (check not needed in BT, because OrderModify() always works) if (!IsTesting() && !IsOptimization()) if(!Hide_SL_TP && MyRealOrdersTotal(Magic)>0) ModifyAll(); return (0); } // end start() ///////////////////////////////////////////////////////////////////////////////////////////////////////////// int MyRealOrdersTotal(int Magic) { int i, count = 0; for(i=0;i<OrdersTotal();i++) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if(OrderMagicNumber()==Magic && OrderSymbol()==Symbol() && OrderType()<=OP_SELL) count++; } return(count); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////// double LastSellPrice() { double l_ord_open_price_8=0; int l_ticket_24; double ld_unused_0 = 0; int l_ticket_20 = 0; for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) { OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() == OP_SELL) { l_ticket_24 = OrderTicket(); if (l_ticket_24 > l_ticket_20) { l_ord_open_price_8 = OrderOpenPrice(); ld_unused_0 = l_ord_open_price_8; l_ticket_20 = l_ticket_24; } } } return (l_ord_open_price_8); } ////////////////////////////////////////////////////////////////////////////////////////////////////////// double LastBuyPrice() { double l_ord_open_price_8=0; int l_ticket_24=0; double ld_unused_0 = 0; int l_ticket_20 = 0; for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) { OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() == OP_BUY ) { l_ticket_24 = OrderTicket(); if (l_ticket_24 > l_ticket_20) { l_ord_open_price_8 = OrderOpenPrice(); ld_unused_0 = l_ord_open_price_8; l_ticket_20 = l_ticket_24; } } } return (l_ord_open_price_8); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// int LastOpenType() { int l_ord_type=-1; int l_ticket_24=0; double ld_unused_0 = 0; int l_ticket_20 = 0; for (int l_pos_16 = OrdersTotal() - 1; l_pos_16 >= 0; l_pos_16--) { OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() <= OP_SELL) { l_ticket_24 = OrderTicket(); if (l_ticket_24 > l_ticket_20) { l_ord_type = OrderType(); ld_unused_0 = l_ord_type; l_ticket_20 = l_ticket_24; } } } return (l_ord_type); } //////////////////////////////////////////////////////////////////////////////////////////////////////// int CloseAll(int Magic) { int i; for (i=OrdersTotal()-1;i>=0;i--) { OrderSelect(i,SELECT_BY_POS,MODE_TRADES); if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) switch(OrderType()) { case OP_BUY: OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Blue); break; case OP_SELL: OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Red); break; } } return(0); } ///////////////////////////////////////////////////////////////////////////////////////////////////////////// double CalculateLots(double r) { int SL = 1000; double ls, minl, maxl, rval; ls = MarketInfo(Symbol(),MODE_LOTSTEP); minl = MarketInfo(Symbol(),MODE_MINLOT); maxl = MarketInfo(Symbol(),MODE_MAXLOT); if(LotSize>0.0) rval = LotSize; else rval = AccountBalance()*(r/100.0)/(SL*MarketInfo(Symbol(),MODE_TICKVALUE)*Point/MarketInfo(Symbol(),MODE_TICKSIZE)); return(MathMin(MathMax(minl,MathRound(rval/ls)*ls),maxl)); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double GetPointValue() { if (MarketInfo(Symbol(),MODE_DIGITS)==5.0 || MarketInfo(Symbol(),MODE_DIGITS)==3.0) return(10.0*Point); else return (Point); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void ModifyAll() { for (int cnt = OrdersTotal()-1 ; cnt >= 0; cnt--) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic ) { if (OrderStopLoss()==0 || OrderTakeProfit()==0) { if((OrderType()==OP_BUY)) OrderModify(OrderTicket(),OrderOpenPrice(),ND(OrderOpenPrice()-PointValue*StopLoss), ND(OrderOpenPrice()+TakeProfit*PointValue),0,Green); if((OrderType()==OP_SELL)) OrderModify(OrderTicket(),OrderOpenPrice(),ND(OrderOpenPrice()+PointValue*StopLoss), ND(OrderOpenPrice()-TakeProfit*PointValue),0,Red); } } } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double Spread(double AddValue=0) { double LastValue; static double ArrayTotal=0; if (AddValue == 0 && SpreadSampleSize <= 0) return(Ask-Bid); if (AddValue == 0 && ArrayTotal == 0) return(Ask-Bid); if (AddValue == 0 ) return(ArrayTotal/ArraySize(Spread)); ArrayTotal = ArrayTotal + AddValue; ArraySetAsSeries(Spread, true); if (ArraySize(Spread) == SpreadSampleSize) { LastValue = Spread[0]; ArrayTotal = ArrayTotal - LastValue; ArraySetAsSeries(Spread, false); ArrayResize(Spread, ArraySize(Spread)-1 ); ArraySetAsSeries(Spread, true); ArrayResize(Spread, ArraySize(Spread)+1 ); } else ArrayResize(Spread, ArraySize(Spread)+1 ); // Print("ArraySize = ",ArraySize(lSpread)," AddedNo. = ",AddValue); ArraySetAsSeries(Spread, false); Spread[0] = AddValue; return(NormalizeDouble(ArrayTotal/ArraySize(Spread), Digits)); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double ND(double Price=0.0) { return(NormalizeDouble(Price,Digits)); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Display() { string starthrs, stophrs; starthrs = DoubleToHHMM(Open_Hour); stophrs = DoubleToHHMM(Close_Hour); Comment( "\n*=====================*", "\n "+EA_Name, "\n v"+EA_Version+" modded by pip.digger", "\n*=====================*", "\n "+Session, "\n*=====================*", "\n GMT Offset = ", GMT_Offset, "\n GMT Time = ", TimeToStr(TimeCurrent()-GMT_Offset*3600, TIME_MINUTES|TIME_SECONDS), "\n Broker Time = ", TimeToStr(TimeCurrent(), TIME_MINUTES|TIME_SECONDS), "\n Start Hour = "+starthrs, "\n End Hour = "+stophrs, "\n", "\n Magic Number = "+Magic, "\n Maximum Spread = "+DoubleToStr(Max_Spread,1), "\n Average Spread = "+DoubleToStr(Spread()/PointValue,1), "\n Lot size = " +DoubleToStr(CalculateLots(Risk),2), "\n Stop Loss = "+DoubleToStr(StopLoss,1), "\n*=====================*", "\n Total Profit (Loss) = "+DoubleToStr(TotalProfit()+Profit(),2), "\n*=====================*", "\n B A L A N C E = " + DoubleToStr(AccountBalance(),2), "\n E Q U I T Y = " + DoubleToStr(AccountEquity(),2), "\n Leverage = 1:" + DoubleToStr(AccountLeverage(),0), "\n*=====================*" ); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double TotalProfit() { double profit = 0; int cnt = OrdersHistoryTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) profit += OrderProfit(); } return (profit); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double Profit() { int c=0; int total = OrdersTotal(); double Profit=0; for (int cnt = 0 ; cnt < total ; cnt++) { OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType()<=OP_SELL) Profit+=OrderProfit(); } return(Profit); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// int LastClosedType(int Magic) { int xyz=OrdersHistoryTotal() - 2; if (!IsTesting() && !IsOptimization()) xyz=0; int l_ord_type=-1; int l_ticket_24=0; double ld_unused_0 = 0; int l_ticket_20 = 0; for (int l_pos_16 = OrdersHistoryTotal() - 1; l_pos_16 >= xyz; l_pos_16--) { OrderSelect(l_pos_16, SELECT_BY_POS, MODE_HISTORY); if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() <= OP_SELL) { l_ticket_24 = OrderTicket(); if (l_ticket_24 > l_ticket_20) { l_ord_type = OrderType(); ld_unused_0 = l_ord_type; l_ticket_20 = l_ticket_24; } } } return (l_ord_type); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double LastClosedProfit(int Magic) { int xyz=OrdersHistoryTotal() - 2; if (!IsTesting() && !IsOptimization()) xyz=0; double l_ord_profit=0; int l_ticket_24=0; double ld_unused_0 = 0; int l_ticket_20 = 0; for (int l_pos_16 = OrdersHistoryTotal() - 1; l_pos_16 >= xyz; l_pos_16--) { OrderSelect(l_pos_16, SELECT_BY_POS, MODE_HISTORY); if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() <= OP_SELL) { l_ticket_24 = OrderTicket(); if (l_ticket_24 > l_ticket_20) { l_ord_profit = OrderProfit(); ld_unused_0 = l_ord_profit; l_ticket_20 = l_ticket_24; } } } return (l_ord_profit); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// double LastClosedPrice(int Magic) { int xyz=OrdersHistoryTotal() - 2; if (!IsTesting() && !IsOptimization()) xyz=0; double l_ord_price=0; int l_ticket_24=0; double ld_unused_0 = 0; int l_ticket_20 = 0; for (int l_pos_16 = OrdersHistoryTotal() - 1; l_pos_16 >= xyz; l_pos_16--) { OrderSelect(l_pos_16, SELECT_BY_POS, MODE_HISTORY); if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() <= OP_SELL) { l_ticket_24 = OrderTicket(); if (l_ticket_24 > l_ticket_20) { l_ord_price = OrderClosePrice(); ld_unused_0 = l_ord_price; l_ticket_20 = l_ticket_24; } } } return (l_ord_price); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// datetime LastClosedTime(int Magic) { int xyz=OrdersHistoryTotal() - 2; if (!IsTesting() && !IsOptimization()) xyz=0; datetime l_ord_time=0; int l_ticket_24=0; datetime ld_unused_0 = 0; int l_ticket_20 = 0; for (int l_pos_16 = OrdersHistoryTotal() - 1; l_pos_16 >= xyz; l_pos_16--) { OrderSelect(l_pos_16, SELECT_BY_POS, MODE_HISTORY); if (OrderSymbol() != Symbol() || OrderMagicNumber() != Magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderType() <= OP_SELL) { l_ticket_24 = OrderTicket(); if (l_ticket_24 > l_ticket_20) { l_ord_time = OrderCloseTime(); ld_unused_0 = l_ord_time; l_ticket_20 = l_ticket_24; } } } return (l_ord_time); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // automagic number generator int AutoMagic() { int m, dE; string s; s = StringConcatenate(EA_Name,MagicKey,Symbol(),Period(),DoubleToStr(AccountNumber(),0),AccountCompany()); m = djb2(s); if(m < 0) m = -m; dE = MathPow(10.0,MathMod(m/7,4)+5); m = MathMod(m,dE)+(m-MathMod(m,dE))/dE; if(m > dE) m = MathMod(m,dE); return(m); } // djb2 hash int djb2(string key){ int i, h = 5381, c; for (i = 0; i < StringLen(key); i++){ c = StringGetChar(key, i); h = (h << 5) + h + c; } return(h); } // get GMT offset via GetSystemTime int GetGMT_Offset() { double GMT_Diff; int SYSTEMTIME[4]; int nYear, nMonth, nDay, nHour, nMin, nSec, nMilliSec; string sMonth, sDay, sHour, sMin, sSec; string sUTC_Time; GetSystemTime(SYSTEMTIME); nYear = SYSTEMTIME[0]&0x0000FFFF; nMonth = SYSTEMTIME[0]>>16; nDay = SYSTEMTIME[1]>>16; nHour = SYSTEMTIME[2]&0x0000FFFF; nMin = SYSTEMTIME[2]>>16; nSec = SYSTEMTIME[3]&0x0000FFFF; nMilliSec = SYSTEMTIME[3]>>16; sMonth = 100 + nMonth; sMonth = StringSubstr(sMonth, 1); sDay = 100 + nDay; sDay = StringSubstr(sDay, 1); sHour = 100 + nHour; sHour = StringSubstr(sHour, 1); sMin = 100 + nMin; sMin = StringSubstr(sMin, 1); sSec = 100 + nSec; sSec = StringSubstr(sSec, 1); sUTC_Time = StringConcatenate(nYear,".",sMonth,".",sDay," ",sHour,":",sMin,":",sSec); GMT_Diff = TimeCurrent() - StrToTime(sUTC_Time); return(MathRound(GMT_Diff / 3600.0)); } // return true if current server time is in DST days for EST/EDT bool IsEDT() { datetime servertime; datetime EDTstart[9], EDTend[9]; int i; EDTstart[0] = D'2007.03.11'; EDTend[0] = D'2007.11.04'; EDTstart[1] = D'2008.03.09'; EDTend[1] = D'2008.11.02'; EDTstart[2] = D'2009.03.08'; EDTend[2] = D'2009.11.01'; EDTstart[3] = D'2010.03.14'; EDTend[3] = D'2010.11.07'; EDTstart[4] = D'2011.03.13'; EDTend[4] = D'2011.11.06'; EDTstart[5] = D'2012.03.11'; EDTend[5] = D'2012.11.04'; EDTstart[6] = D'2013.03.10'; EDTend[6] = D'2013.11.03'; EDTstart[7] = D'2014.03.09'; EDTend[7] = D'2014.11.02'; EDTstart[8] = D'2015.03.08'; EDTend[8] = D'2015.11.01'; servertime = TimeCurrent(); for(i = 0; i < 9; i++) if(servertime > EDTstart[i] && servertime < EDTend[i]) return(true); return(false); } // Set Trading Hours after GMT_Offset change void SetTradeHrs() { double DST_Offset = 0.0; if(IsEDT()) DST_Offset = 1.0; if((IsTesting()||IsOptimization())&&!HistoryUsesDST) DST_Offset = 0.0; Open_Hour = GMT_Open_Hour + GMT_Offset - DST_Offset; Close_Hour = GMT_Close_Hour + GMT_Offset - DST_Offset; Friday_Hour = GMT_Friday_Hour + GMT_Offset - DST_Offset; if(Open_Hour>=24.0) Open_Hour-=24.0; if(Close_Hour>=24.0) Close_Hour-=24.0; if(Friday_Hour>=24.0) Friday_Hour-=24.0; } string DoubleToHHMM(double hrs) { string HH, MM, HHMM; hrs = MathMod(hrs, 24.0); HH = StringSubstr(DoubleToStr(100.0 + MathFloor(hrs), 0), 1); hrs -= MathFloor(hrs); hrs *= 0.6; MM = StringSubstr(DoubleToStr(100.0 * hrs + 100.0,0), 1); HHMM = StringConcatenate(HH, ":", MM); Print(HHMM); return(HHMM); } bool SetDefaults() { if(StringFind(Symbol(),"EURCAD")!=-1) { if(Max_Spread==0)Max_Spread=6;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 60;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=120; Use_WPR = true;WPR_Period=10;WPR_Entry=91;WPR_Exit=40; Use_Fractals = true;MidFractalDist=6;OppositFractalDist=11; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"EURGBP")!=-1) { if(Max_Spread==0)Max_Spread=4;if(Risk==0.0)Risk=5.0;TakeProfit=60.0;StopLoss= 60;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=120; Use_WPR = true;WPR_Period=11;WPR_Entry=90;WPR_Exit=40; Use_Fractals = true;MidFractalDist=5;OppositFractalDist=9; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"USDCAD")!=-1) { if(Max_Spread==0)Max_Spread=4;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 60;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=120;CCI_Exit=125; Use_WPR = true;WPR_Period=10;WPR_Entry=90;WPR_Exit=35; Use_Fractals = true;MidFractalDist=8;OppositFractalDist=11; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"EURCHF")!=-1) { if(Max_Spread==0)Max_Spread=5;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 40;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=130; Use_WPR = true;WPR_Period=10;WPR_Entry=91;WPR_Exit=30; Use_Fractals = true;MidFractalDist=7;OppositFractalDist=9; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"USDCHF")!=-1) { if(Max_Spread==0)Max_Spread=4;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 40;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=120; Use_WPR = true;WPR_Period=10;WPR_Entry=91;WPR_Exit=40; Use_Fractals = true;MidFractalDist=6;OppositFractalDist=9; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"GBPCHF")!=-1) { if(Max_Spread==0)Max_Spread=6;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 50;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=130; Use_WPR = true;WPR_Period=10;WPR_Entry=91;WPR_Exit=30; Use_Fractals = true;MidFractalDist=9;OppositFractalDist=15; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"GBPCAD")!=-1) { if(Max_Spread==0)Max_Spread=6;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 50;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=130; Use_WPR = true;WPR_Period=10;WPR_Entry=91;WPR_Exit=30; Use_Fractals = true;MidFractalDist=7;OppositFractalDist=13; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"EURUSD")!=-1) { if(Max_Spread==0)Max_Spread=4;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 40;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=120; Use_WPR = true;WPR_Period=8;WPR_Entry=93;WPR_Exit=42; Use_Fractals = true;MidFractalDist=8;OppositFractalDist=15; Use_MA1 = true;MA_Period1=75; // only EURUSD Use_MA2 = true;MA_Period2=20; // only EURUSD Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"CADCHF")!=-1) { if(Max_Spread==0)Max_Spread=6;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 50;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=130; Use_WPR = true;WPR_Period=10;WPR_Entry=91;WPR_Exit=30; Use_Fractals = true;MidFractalDist=7;OppositFractalDist=13; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else if(StringFind(Symbol(),"GBPUSD")!=-1) { if(Max_Spread==0)Max_Spread=4;if(Risk==0.0)Risk=7.5;TakeProfit=60.0;StopLoss= 40;Open_Hour= 20;Close_Hour=23; Friday_Hour=15; Use_CCI = true;CCI_Period=10;CCI_Entry=100;CCI_Exit=125; Use_WPR = true;WPR_Period=12;WPR_Entry=90;WPR_Exit=38; Use_Fractals = true;MidFractalDist=6;OppositFractalDist=11; Use_MA1 = false;MA_Period1=25; Use_MA2 = false;MA_Period2=20; Use_MA2_Slope = false;MA_Slope=5; } else { Print("WARNING: Unsupported instrument, using manual defaults."); return(false); } return(true); }
Комментарии к исходному коду форекс советника Free_Momods_Night_Scalper_v0.9.2_(v3.02).mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.