yuppi Posted July 29, 2009 Report Posted July 29, 2009 Need a programmer for modifying 4 to 5 digits. This is the BankingFX Diamond which works great. But at the moment it works just with 4 digits brokers. Can someone modify so it works with 4 and 5 digits? Thanks in advance. Would be nice if someone can help. Here is the file: hxxp://sharebee.com/426baaee Best regards
Pheniox Posted July 29, 2009 Report Posted July 29, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. Should work test on demo first //==================================== #property copyright " Banking FX Diamond " #property link "" #include <WinUser32.mqh> //======================== extern string Broker = "------Broker Five or Four Digit------"; extern bool FiveDigitsBroker = true; extern int MagicNumber = 9815756; extern string Lots_Parameters = "Lots-Parameters"; extern double Lots = 0.1; extern bool LotsOptimized = TRUE; extern int Risk = 10; extern int Maximum_Lots = 60; extern int Slippage = 4; //works better at 2 extern int SlippageClose = 4; //works better at 2 extern double MaxSpread = 3.1; //works better at 5.1 extern double TakeProfit = 5.0; extern string Server_Time = "Aviation Servertime from GMT (Greenwich Mean Time)"; extern int GMT = 2; //======================== string gs_unused_76 = "BankingFX Diamond 15M"; int gi_88 = 22; int gi_92 = 2; int gi_96 = 50; int ticket; string gs_unused_128 = "Order-Parameters"; double gd_136 = 32.0; bool gi_164 = FALSE; bool gi_184 = TRUE; bool gi_188 = TRUE; int gi_192 = 60; int gi_196 = 3; int gi_200 = 140; int gi_204 = 2; int gi_208 = 170; int gi_212 = 0; int gi_216 = 200; int gi_220 = 1; int gi_224 = 240; int gi_228 = 4; extern string gs_unused_232 = "Market-Parameters"; bool gi_240 = TRUE; extern int HoursStopped = 80; //works better at 40 string gs_unused_248 = "Volatility-Parameters"; bool gi_256 = FALSE; double gd_260 = 0.001; double gd_268 = 0.001; double gd_276 = 0.0012; int g_period_284 = 8; double g_period_288 = 6.0; double g_timeframe_296 = 15.0; double gd_304 = 30.0; double gd_312 = 70.0; double gd_320 = 40.0; double gd_328 = 60.0; bool gi_336 = TRUE; bool gi_340 = TRUE; double g_minlot_344 = 0.0; double g_maxlot_352 = 0.0; int gi_360 = 0; int g_leverage_364 = 0; double g_lots_368; double gd_376; double _g_point; int init() { //======================== _g_point = Point; if(FiveDigitsBroker) { if(Digits==4 || Digits==2) if(MessageBox("You selected 5 digits broker but it seems to be 4 digits one! Please change FiveDigitsBroker = true to false. \nContinue?","Question", MB_YESNO|MB_ICONQUESTION)==IDNO) return(0); _g_point = Point*10; gd_376= _g_point; //SpreadLimit*= 10; Print("Platform Point is ", Point,"; we are using ",_g_point); } return(0); } int deinit() { return (0); } int start() { double ld_0; double ld_8; if (GMT == -24) { gi_88 = 20; gi_92 = 0; } if (GMT == -23) { gi_88 = 21; gi_92 = 1; } if (GMT == -22) { gi_88 = 22; gi_92 = 2; } if (GMT == -21) { gi_88 = 23; gi_92 = 3; } if (GMT == -20) { gi_88 = 0; gi_92 = 4; } if (GMT == -19) { gi_88 = 1; gi_92 = 5; } if (GMT == -18) { gi_88 = 2; gi_92 = 6; } if (GMT == -17) { gi_88 = 3; gi_92 = 7; } if (GMT == -16) { gi_88 = 4; gi_92 = 8; } if (GMT == -15) { gi_88 = 5; gi_92 = 9; } if (GMT == -14) { gi_88 = 6; gi_92 = 10; } if (GMT == -13) { gi_88 = 7; gi_92 = 11; } if (GMT == -12) { gi_88 = 8; gi_92 = 12; } if (GMT == -11) { gi_88 = 9; gi_92 = 13; } if (GMT == -10) { gi_88 = 10; gi_92 = 14; } if (GMT == -9) { gi_88 = 11; gi_92 = 15; } if (GMT == -8) { gi_88 = 12; gi_92 = 16; } if (GMT == -7) { gi_88 = 13; gi_92 = 17; } if (GMT == -6) { gi_88 = 14; gi_92 = 18; } if (GMT == -5) { gi_88 = 15; gi_92 = 19; } if (GMT == -4) { gi_88 = 16; gi_92 = 20; } if (GMT == -3) { gi_88 = 17; gi_92 = 21; } if (GMT == -2) { gi_88 = 18; gi_92 = 22; } if (GMT == -1) { gi_88 = 19; gi_92 = 23; } if (GMT == 0) { gi_88 = 20; gi_92 = 0; } if (GMT == 1) { gi_88 = 21; gi_92 = 1; } if (GMT == 2) { gi_88 = 22; gi_92 = 2; } if (GMT == 3) { gi_88 = 23; gi_92 = 3; } if (GMT == 4) { gi_88 = 0; gi_92 = 4; } if (GMT == 5) { gi_88 = 1; gi_92 = 5; } if (GMT == 6) { gi_88 = 2; gi_92 = 6; } if (GMT == 7) { gi_88 = 3; gi_92 = 7; } if (GMT == 8) { gi_88 = 4; gi_92 = 8; } if (GMT == 9) { gi_88 = 5; gi_92 = 9; } if (GMT == 10) { gi_88 = 6; gi_92 = 10; } if (GMT == 11) { gi_88 = 7; gi_92 = 11; } if (GMT == 12) { gi_88 = 8; gi_92 = 12; } if (GMT == 13) { gi_88 = 9; gi_92 = 13; } if (GMT == 14) { gi_88 = 10; gi_92 = 14; } if (GMT == 15) { gi_88 = 11; gi_92 = 15; } if (GMT == 16) { gi_88 = 12; gi_92 = 16; } if (GMT == 17) { gi_88 = 13; gi_92 = 17; } if (GMT == 18) { gi_88 = 14; gi_92 = 18; } if (GMT == 19) { gi_88 = 15; gi_92 = 19; } if (GMT == 20) { gi_88 = 16; gi_92 = 20; } if (GMT == 21) { gi_88 = 17; gi_92 = 21; } if (GMT == 22) { gi_88 = 18; gi_92 = 22; } if (GMT == 23) { gi_88 = 19; gi_92 = 23; } if (GMT == 24) { gi_88 = 20; gi_92 = 0; } Comment("Server Time: ", TimeToStr(TimeCurrent(), TIME_MINUTES)); if (Symbol() != "EURGBP" && Symbol() != "EURGBPm" && Symbol() != "EURGBPfx_1" && Symbol() != "EURGBP-fx") return; double l_price_16 = TakeProfit; if (gi_164 == TRUE) { for (int l_pos_24 = 0; l_pos_24 < OrdersTotal(); l_pos_24++) { OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber) { if (Bid >= OrderOpenPrice() + TakeProfit * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, SlippageClose, Orange); Print("Virtual TP - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit : $ " + DoubleToStr(OrderProfit(), 2)); } } if (OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber) { if (Ask <= OrderOpenPrice() - TakeProfit * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, SlippageClose, Orange); Print("Virtual TP - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit : $ " + DoubleToStr(OrderProfit(), 2)); } } } } if (gi_188 == TRUE) { for (int l_pos_28 = 0; l_pos_28 < OrdersTotal(); l_pos_28++) { OrderSelect(l_pos_28, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber) { if (TimeCurrent() - OrderOpenTime() > 60 * gi_192 && TimeCurrent() - OrderOpenTime() < 60 * gi_200 && Bid >= OrderOpenPrice() + gi_196 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, SlippageClose, Orange); Print("Prot. Level 1 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_200 && TimeCurrent() - OrderOpenTime() < 60 * gi_208 && Bid >= OrderOpenPrice() + gi_204 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, SlippageClose, Orange); Print("Prot. Level 2 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_208 && TimeCurrent() - OrderOpenTime() < 60 * gi_216 && Bid >= OrderOpenPrice() - gi_212 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, SlippageClose, Orange); Print("Prot. Level 3 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_216 && TimeCurrent() - OrderOpenTime() < 60 * gi_224 && Bid >= OrderOpenPrice() - gi_220 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, SlippageClose, Orange); Print("Prot. Level 4 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_224 && Bid >= OrderOpenPrice() - gi_228 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, SlippageClose, Orange); Print("Prot. Level 5 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } } if (OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber) { if (TimeCurrent() - OrderOpenTime() > 60 * gi_192 && TimeCurrent() - OrderOpenTime() < 60 * gi_200 && Ask <= OrderOpenPrice() - gi_196 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, SlippageClose, Orange); Print("Prot. Level 1 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_200 && TimeCurrent() - OrderOpenTime() < 60 * gi_208 && Ask <= OrderOpenPrice() - gi_204 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, SlippageClose, Orange); Print("Prot. Level 2 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_208 && TimeCurrent() - OrderOpenTime() < 60 * gi_216 && Ask <= OrderOpenPrice() + gi_212 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, SlippageClose, Orange); Print("Prot. Level 3 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_216 && TimeCurrent() - OrderOpenTime() < 60 * gi_224 && Ask <= OrderOpenPrice() + gi_220 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, SlippageClose, Orange); Print("Prot. Level 4 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_224 && Ask <= OrderOpenPrice() + gi_228 * gd_376) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, SlippageClose, Orange); Print("Prot. Level 5 - Close Price: " + DoubleToStr(OrderClosePrice(), 4) + " Lots : " + DoubleToStr(OrderLots(), 2) + " Order Number : " + DoubleToStr(OrderTicket(), 0) + " Profit: $ " + DoubleToStr(OrderProfit(), 2)); } } } } if (!gi_164 && gi_184 == TRUE) { for (int l_pos_32 = 0; l_pos_32 < OrdersTotal(); l_pos_32++) { OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES); ld_0 = NormalizeDouble(OrderTakeProfit() - OrderOpenPrice(), 7); ld_8 = NormalizeDouble(OrderOpenPrice() - OrderTakeProfit(), 7); if (OrderType() == OP_BUY && OrderMagicNumber() == MagicNumber && ld_0 != TakeProfit * gd_376) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - gd_136 * gd_376, OrderOpenPrice() + TakeProfit * gd_376, 0, Green); if (OrderType() == OP_SELL && OrderMagicNumber() == MagicNumber && ld_8 != TakeProfit * gd_376) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + gd_136 * gd_376, OrderOpenPrice() - TakeProfit * gd_376, 0, Red); } } if (gi_256 == TRUE) { if (iOpen(Symbol(), PERIOD_M5, 0) >= Ask + gd_260) return; if (iOpen(Symbol(), PERIOD_M5, 0) <= Bid - gd_260) return; if (iOpen(Symbol(), PERIOD_M5, 1) >= Ask + gd_268) return; if (iOpen(Symbol(), PERIOD_M5, 1) <= Bid - gd_268) return; if (iOpen(Symbol(), PERIOD_M5, 2) >= Ask + gd_276) return; if (iOpen(Symbol(), PERIOD_M5, 2) <= Bid - gd_276) return; } if (Ask - Bid > MaxSpread / 10000.0) return (0); g_minlot_344 = MarketInfo(Symbol(), MODE_MINLOT); g_maxlot_352 = MarketInfo(Symbol(), MODE_MAXLOT); g_leverage_364 = AccountLeverage(); gi_360 = MarketInfo(Symbol(), MODE_LOTSIZE); g_lots_368 = MathMin(g_maxlot_352, MathMax(g_minlot_344, Lots)); if (LotsOptimized && Risk > 0.0) g_lots_368 = MathMax(g_minlot_344, MathMin(g_maxlot_352, NormalizeDouble(Risk / 100.0 * AccountFreeMargin() / g_minlot_344 / (gi_360 / 100), 0) * g_minlot_344)); g_lots_368 = MathMax(g_minlot_344, MathMin(g_maxlot_352, NormalizeDouble(g_lots_368 / g_minlot_344, 0) * g_minlot_344)); g_lots_368 = NormalizeDouble(g_lots_368, 1); if (AccountFreeMargin() < Ask * g_lots_368 * gi_360 / g_leverage_364) { Print("Low Account Balance. Lots: ", g_lots_368, " , Free Margin = ", AccountFreeMargin()); Comment("Low Account Balance. Lots = ", g_lots_368, " , Free Margin = ", AccountFreeMargin()); return; } if (g_lots_368 > Maximum_Lots) g_lots_368 = Maximum_Lots; double l_irsi_36 = iRSI(NULL, g_timeframe_296, g_period_288, PRICE_CLOSE, 0); double l_irsi_44 = iRSI(NULL, PERIOD_M1, 20, PRICE_CLOSE, 0); double ld_52 = NormalizeDouble(iMA(NULL, 0, g_period_284, 0, MODE_SMA, PRICE_MEDIAN, 1), 4); double ld_60 = NormalizeDouble(iMA(NULL, 0, g_period_284, 0, MODE_SMA, PRICE_MEDIAN, 1), 4); if (GetLastError() == 138/* REQUOTE */ || GetLastError() == 146/* TRADE_CONTEXT_BUSY */) { Print("get last error 138 or 146"); if (!ExistPosition()) { Print("short and long = true"); gi_340 = TRUE; gi_336 = TRUE; } } if (gi_240 == TRUE) if (ExistLastLoss()) return (0); if (IsTradeTime()) { if (DayOfWeek() == 0 || DayOfWeek() == 5) return (0); if (DayOfWeek() == 1 && Hour() < gi_88) return (0); if (!ExistPosition() && l_irsi_36 < gd_304 || l_irsi_44 < 36.0 && ld_52 >= Ask + 0.0002) { if (gi_336) { l_price_16 = 0; if (!gi_164) l_price_16 = Ask + TakeProfit * gd_376; ticket=OrderSend(Symbol(), OP_BUY, g_lots_368, Ask, Slippage, 0,0 , "Banking", MagicNumber, 0, Green); if (ticket > 0) { OrderSelect(ticket, SELECT_BY_TICKET); ticket=OrderModify(OrderTicket(), OrderOpenPrice(), Ask - gd_136 * gd_376, l_price_16, 0, Green); } gi_336 = FALSE; gi_340 = TRUE; } } if (!ExistPosition() && l_irsi_36 > gd_312 || l_irsi_44 > 64.0 && ld_60 <= Bid - 0.0002) { if (gi_340) { l_price_16 = 0; if (!gi_164) l_price_16 = Bid - TakeProfit * gd_376; ticket=OrderSend(Symbol(), OP_SELL, g_lots_368, Bid, Slippage, 0, 0, "Banking", MagicNumber, 0, Red); if (ticket > 0) { OrderSelect(ticket, SELECT_BY_TICKET); ticket=OrderModify(OrderTicket(), OrderOpenPrice(), Bid + gd_136 * gd_376, l_price_16, 0, Red); } gi_340 = FALSE; gi_336 = TRUE; } } if (l_irsi_36 < gd_328 && l_irsi_36 > gd_320) { gi_340 = TRUE; gi_336 = TRUE; } } return (0); } bool IsTradeTime() { if (gi_88 < gi_92 && TimeHour(TimeCurrent()) < gi_88 || TimeHour(TimeCurrent()) >= gi_92) return (FALSE); if (gi_88 > gi_92 && (TimeHour(TimeCurrent()) < gi_88 && TimeHour(TimeCurrent()) >= gi_92)) return (FALSE); if (gi_92 == 0) gi_92 = 24; if (Hour() == gi_92 - 1 && Minute() >= gi_96) return (FALSE); return (TRUE); } bool ExistPosition() { bool li_ret_0 = FALSE; for (int l_pos_4 = 0; l_pos_4 < OrdersTotal(); l_pos_4++) { if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { if (OrderType() == OP_BUY || OrderType() == OP_SELL) { li_ret_0 = TRUE; break; } } } } return (li_ret_0); } bool ExistLastLoss() { bool li_ret_0 = FALSE; int l_hist_total_4 = OrdersHistoryTotal(); if (l_hist_total_4 > 0) { if (OrderSelect(l_hist_total_4 - 1, SELECT_BY_POS, MODE_HISTORY) == TRUE) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { if (OrderClosePrice() <= OrderStopLoss() && OrderType() == OP_BUY) { RefreshRates(); if (TimeCurrent() - OrderOpenTime() < 3600 * HoursStopped) { Print("System stopped ", HoursStopped, " hours after last loss"); Comment("Server Time: ", TimeToStr(TimeCurrent(), TIME_MINUTES), "\n", "System stopped ", HoursStopped, " hours after last loss"); li_ret_0 = TRUE; } } if (OrderClosePrice() >= OrderStopLoss() && OrderType() == OP_SELL) { RefreshRates(); if (TimeCurrent() - OrderOpenTime() < 3600 * HoursStopped) { Print("System stopped ", HoursStopped, " hours after last loss"); Comment("Server Time: ", TimeToStr(TimeCurrent(), TIME_MINUTES), "\n", "System stopped ", HoursStopped, " hours after last loss"); li_ret_0 = TRUE; } } } } } return (li_ret_0); } //=========================
yuppi Posted July 29, 2009 Author Report Posted July 29, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. Thanks. I will try it out and test it on demo. Best regards :-bd
yuppi Posted July 30, 2009 Author Report Posted July 30, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. Not sure if it works. Today I had trades with the old version of 4 digits broker. With the new version, which I installed on 2 different brokers, I had 0 trades on both. Will see what happens tomorrow and day after tomorrow.
odrisb Posted July 30, 2009 Report Posted July 30, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. Not sure if it works. Today I had trades with the old version of 4 digits broker. With the new version, which I installed on 2 different brokers, I had 0 trades on both. Will see what happens tomorrow and day after tomorrow. Try this: :-bd BankingFX Diamond EURGBP 15m.mq4[/attachment:1mtju9tb]
yuppi Posted July 31, 2009 Author Report Posted July 31, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. Thanks. As I have seen, its already programmed for ECN brokers. Nice. Thanks again. :-bd
bratt Posted July 31, 2009 Report Posted July 31, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. Thats very cool thanks gyus:-)
yuppi Posted August 5, 2009 Author Report Posted August 5, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. Thanks to Pheniox again. I tried your EA out again. I had to change something in the code because at my broker they use a different name. Not EURGBP. They use EURGBP.. After I modified it, it worked. But it was not your fault. Thanks again for helping me out. You did great job. :-bd
wirastomo Posted August 6, 2009 Report Posted August 6, 2009 Re: Need a programmer for modifying 4 to 5 digits broker. guys,... Any Manual or setting of this EA,.. I search not find... may you can share,... many thank's
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now