invalid integer number as parameter 2 for 'iCustom' function
ما معنى هذه الرساله في اكسبيرت وطريقة تصحيحيها وشكرا
|
جديد المواضيع |
|
منتدى المؤشرات و الاكسبيرتات تعليم برمجة الاكسبيرت ، اكسبيرت مجانى ، برمجة مؤشرات ، مؤشر ، تصميم اكسبيرت مجانا ، اكسبيرتات جديدة ، مؤشرات جديدة ، كل ما يتعلق بالتحليل و الخاص بالمؤشرات الفنية او الرقمية ، Expert advisor ، mql ، mql4 ، دورة برمجة ، برمجة اكسبيرت ، اكسبيرت رابح ، اكسبيرت جيد ، ادارة حسابات ، تداول الى ، ميتاتريدر ، تحميل منصة ، منصة تداول ، برمجة مؤشر ، مكتبة مؤشرات ، مؤشر جديد ، مؤشرات جديدة ، مؤشر حصرى ، احدث مؤشر . |
|
أدوات الموضوع |
04-02-2016, 03:26 PM | المشاركة رقم: 1 | ||||||||||||||||||||||||
|
المنتدى :
منتدى المؤشرات و الاكسبيرتات
الى استاذ اسلام ارجو المساعده
invalid integer number as parameter 2 for 'iCustom' function |
||||||||||||||||||||||||
|
#1
|
|
|
|
الى استاذ اسلام ارجو المساعده
invalid integer number as parameter 2 for 'iCustom' function
ما معنى هذه الرساله في اكسبيرت وطريقة تصحيحيها وشكرا |
04-02-2016, 04:15 PM | المشاركة رقم: 2 | ||||||||||||||||||||||||||||
|
كاتب الموضوع :
sal_moh85
المنتدى :
منتدى المؤشرات و الاكسبيرتات
رد: الى استاذ اسلام ارجو المساعده
|
||||||||||||||||||||||||||||
|
#2
|
|
|
|
رد: الى استاذ اسلام ارجو المساعده
|
04-02-2016, 04:31 PM | المشاركة رقم: 3 | ||||||||||||||||||||||||
|
كاتب الموضوع :
sal_moh85
المنتدى :
منتدى المؤشرات و الاكسبيرتات
رد: الى استاذ اسلام ارجو المساعده
مشكور |
||||||||||||||||||||||||
|
#3
|
|
|
|
رد: الى استاذ اسلام ارجو المساعده
مشكور
if ((iCustom(NULL, NULL, "mohamad",180,1,5,0,2) > 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,0,1) > 0)) هذه الداله اين الخطاء الموشر يعتمد على وقتين الخمس دقائق ودقيقه |
04-02-2016, 05:07 PM | المشاركة رقم: 4 | ||||||||||||||||||||||||||||
|
كاتب الموضوع :
sal_moh85
المنتدى :
منتدى المؤشرات و الاكسبيرتات
رد: الى استاذ اسلام ارجو المساعده
|
||||||||||||||||||||||||||||
|
#4
|
|
|
|
رد: الى استاذ اسلام ارجو المساعده
|
04-02-2016, 05:26 PM | المشاركة رقم: 5 | ||||||||||||||||||||||||
|
كاتب الموضوع :
sal_moh85
المنتدى :
منتدى المؤشرات و الاكسبيرتات
رد: الى استاذ اسلام ارجو المساعده
#property link "sal_moh85@hotmail.com" #include <stdlib.mqh> #include <WinUser32.mqh> // exported variables extern double Lots = 1; extern int Stoploss = 30; extern int Takeprofit = 50; extern int TrailingStop14 = 12; extern int NewTakeProfit14 = 30; extern int TrailingGap14 = 7; // local variables double PipValue=1; // this variable is here to support 5-digit brokers bool Terminated = false; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; int init() { NDigits = Digits; ObjectsDeleteAll(); // clear the chart Comment(""); // clear the chart } // Expert start int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (Terminated == true) { Comment("EA Terminated."); return (0); } OnEveryTick26(); } void OnEveryTick26() { if (true == false && true) PipValue = 10; if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10; TechnicalAnalysis30(); TechnicalAnalysis27(); TechnicalAnalysis22(); TechnicalAnalysis37(); TechnicalAnalysis39(); TrailingStop14(); TechnicalAnalysis35(); } void TechnicalAnalysis30() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) < 50) { TechnicalAnalysis29(); } } void TechnicalAnalysis29() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x38(); } } void TechnicalAnalysis2x38() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,1,current+2) < 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) > 0)) { IfOrderDoesNotExist7(); } } void IfOrderDoesNotExist7() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { SellOrder33(); } } void SellOrder33() { double SL = Bid + Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Bid - Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, 0, 0, "My Expert", 1, 0, Red); else ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, SL, TP, "My Expert", 1, 0, Red); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis27() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) > 50) { TechnicalAnalysis28(); } } void TechnicalAnalysis28() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x34(); } } void TechnicalAnalysis2x34() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,0,current+2) > 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0)) { IfOrderDoesNotExist31(); } } void IfOrderDoesNotExist31() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { BuyOrder32(); } } void BuyOrder32() { double SL = Ask - Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Ask + Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, 0, 0, "My Expert", 1, 0, Blue); else ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, SL, TP, "My Expert", 1, 0, Blue); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis22() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder8(); } } void CloseOrder8() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis37() { if (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0) { CloseOrder9(); } } void CloseOrder9() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis39() { if (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) < 0) { CloseOrder36(); } } void CloseOrder36() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TrailingStop14() { for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { double takeprofit = OrderTakeProfit(); if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > TrailingStop14*PipValue*Point) { if (OrderStopLoss() < Ask-(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Ask+(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret1 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask-TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret1 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > TrailingStop14*PipValue*Point) { if (OrderStopLoss() > Bid+(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Bid-(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret2 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid+TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret2 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } } } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } void TechnicalAnalysis35() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder25(); } } void CloseOrder25() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } int deinit() { if (false) ObjectsDeleteAll(); } |
||||||||||||||||||||||||
|
#5
|
|
|
|
رد: الى استاذ اسلام ارجو المساعده
#property link "sal_moh85@hotmail.com" #include <stdlib.mqh> #include <WinUser32.mqh> // exported variables extern double Lots = 1; extern int Stoploss = 30; extern int Takeprofit = 50; extern int TrailingStop14 = 12; extern int NewTakeProfit14 = 30; extern int TrailingGap14 = 7; // local variables double PipValue=1; // this variable is here to support 5-digit brokers bool Terminated = false; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; int init() { NDigits = Digits; ObjectsDeleteAll(); // clear the chart Comment(""); // clear the chart } // Expert start int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (Terminated == true) { Comment("EA Terminated."); return (0); } OnEveryTick26(); } void OnEveryTick26() { if (true == false && true) PipValue = 10; if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10; TechnicalAnalysis30(); TechnicalAnalysis27(); TechnicalAnalysis22(); TechnicalAnalysis37(); TechnicalAnalysis39(); TrailingStop14(); TechnicalAnalysis35(); } void TechnicalAnalysis30() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) < 50) { TechnicalAnalysis29(); } } void TechnicalAnalysis29() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x38(); } } void TechnicalAnalysis2x38() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,1,current+2) < 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) > 0)) { IfOrderDoesNotExist7(); } } void IfOrderDoesNotExist7() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { SellOrder33(); } } void SellOrder33() { double SL = Bid + Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Bid - Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, 0, 0, "My Expert", 1, 0, Red); else ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, SL, TP, "My Expert", 1, 0, Red); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis27() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) > 50) { TechnicalAnalysis28(); } } void TechnicalAnalysis28() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x34(); } } void TechnicalAnalysis2x34() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,0,current+2) > 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0)) { IfOrderDoesNotExist31(); } } void IfOrderDoesNotExist31() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { BuyOrder32(); } } void BuyOrder32() { double SL = Ask - Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Ask + Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, 0, 0, "My Expert", 1, 0, Blue); else ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, SL, TP, "My Expert", 1, 0, Blue); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis22() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder8(); } } void CloseOrder8() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis37() { if (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0) { CloseOrder9(); } } void CloseOrder9() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis39() { if (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) < 0) { CloseOrder36(); } } void CloseOrder36() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TrailingStop14() { for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { double takeprofit = OrderTakeProfit(); if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > TrailingStop14*PipValue*Point) { if (OrderStopLoss() < Ask-(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Ask+(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret1 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask-TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret1 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > TrailingStop14*PipValue*Point) { if (OrderStopLoss() > Bid+(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Bid-(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret2 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid+TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret2 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } } } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } void TechnicalAnalysis35() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder25(); } } void CloseOrder25() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } int deinit() { if (false) ObjectsDeleteAll(); } |
04-02-2016, 05:27 PM | المشاركة رقم: 6 | ||||||||||||||||||||||||
|
كاتب الموضوع :
sal_moh85
المنتدى :
منتدى المؤشرات و الاكسبيرتات
رد: الى استاذ اسلام ارجو المساعده
#property link "sal_moh85@hotmail.com" #include <stdlib.mqh> #include <WinUser32.mqh> // exported variables extern double Lots = 1; extern int Stoploss = 30; extern int Takeprofit = 50; extern int TrailingStop14 = 12; extern int NewTakeProfit14 = 30; extern int TrailingGap14 = 7; // local variables double PipValue=1; // this variable is here to support 5-digit brokers bool Terminated = false; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; int init() { NDigits = Digits; ObjectsDeleteAll(); // clear the chart Comment(""); // clear the chart } // Expert start int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (Terminated == true) { Comment("EA Terminated."); return (0); } OnEveryTick26(); } void OnEveryTick26() { if (true == false && true) PipValue = 10; if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10; TechnicalAnalysis30(); TechnicalAnalysis27(); TechnicalAnalysis22(); TechnicalAnalysis37(); TechnicalAnalysis39(); TrailingStop14(); TechnicalAnalysis35(); } void TechnicalAnalysis30() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) < 50) { TechnicalAnalysis29(); } } void TechnicalAnalysis29() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x38(); } } void TechnicalAnalysis2x38() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,1,current+2) < 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) > 0)) { IfOrderDoesNotExist7(); } } void IfOrderDoesNotExist7() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { SellOrder33(); } } void SellOrder33() { double SL = Bid + Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Bid - Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, 0, 0, "My Expert", 1, 0, Red); else ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, SL, TP, "My Expert", 1, 0, Red); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis27() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) > 50) { TechnicalAnalysis28(); } } void TechnicalAnalysis28() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x34(); } } void TechnicalAnalysis2x34() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,0,current+2) > 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0)) { IfOrderDoesNotExist31(); } } void IfOrderDoesNotExist31() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { BuyOrder32(); } } void BuyOrder32() { double SL = Ask - Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Ask + Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, 0, 0, "My Expert", 1, 0, Blue); else ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, SL, TP, "My Expert", 1, 0, Blue); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis22() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder8(); } } void CloseOrder8() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis37() { if (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0) { CloseOrder9(); } } void CloseOrder9() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis39() { if (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) < 0) { CloseOrder36(); } } void CloseOrder36() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TrailingStop14() { for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { double takeprofit = OrderTakeProfit(); if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > TrailingStop14*PipValue*Point) { if (OrderStopLoss() < Ask-(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Ask+(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret1 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask-TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret1 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > TrailingStop14*PipValue*Point) { if (OrderStopLoss() > Bid+(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Bid-(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret2 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid+TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret2 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } } } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } void TechnicalAnalysis35() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder25(); } } void CloseOrder25() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } int deinit() { if (false) ObjectsDeleteAll(); } |
||||||||||||||||||||||||
|
#6
|
|
|
|
رد: الى استاذ اسلام ارجو المساعده
#property link "sal_moh85@hotmail.com" #include <stdlib.mqh> #include <WinUser32.mqh> // exported variables extern double Lots = 1; extern int Stoploss = 30; extern int Takeprofit = 50; extern int TrailingStop14 = 12; extern int NewTakeProfit14 = 30; extern int TrailingGap14 = 7; // local variables double PipValue=1; // this variable is here to support 5-digit brokers bool Terminated = false; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; int init() { NDigits = Digits; ObjectsDeleteAll(); // clear the chart Comment(""); // clear the chart } // Expert start int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (Terminated == true) { Comment("EA Terminated."); return (0); } OnEveryTick26(); } void OnEveryTick26() { if (true == false && true) PipValue = 10; if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10; TechnicalAnalysis30(); TechnicalAnalysis27(); TechnicalAnalysis22(); TechnicalAnalysis37(); TechnicalAnalysis39(); TrailingStop14(); TechnicalAnalysis35(); } void TechnicalAnalysis30() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) < 50) { TechnicalAnalysis29(); } } void TechnicalAnalysis29() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x38(); } } void TechnicalAnalysis2x38() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,1,current+2) < 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) > 0)) { IfOrderDoesNotExist7(); } } void IfOrderDoesNotExist7() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { SellOrder33(); } } void SellOrder33() { double SL = Bid + Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Bid - Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, 0, 0, "My Expert", 1, 0, Red); else ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, SL, TP, "My Expert", 1, 0, Red); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis27() { if (iRSI(NULL, NULL,14,PRICE_CLOSE,1) > 50) { TechnicalAnalysis28(); } } void TechnicalAnalysis28() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) > 20) { TechnicalAnalysis2x34(); } } void TechnicalAnalysis2x34() { if ((iCustom(NULL, NULL, "mohamad",180,1,5,0,current+2) > 0) && (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0)) { IfOrderDoesNotExist31(); } } void IfOrderDoesNotExist31() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { BuyOrder32(); } } void BuyOrder32() { double SL = Ask - Stoploss*PipValue*Point; if (Stoploss == 0) SL = 0; double TP = Ask + Takeprofit*PipValue*Point; if (Takeprofit == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, 0, 0, "My Expert", 1, 0, Blue); else ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, SL, TP, "My Expert", 1, 0, Blue); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis22() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder8(); } } void CloseOrder8() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis37() { if (iCustom(NULL, NULL, "mohamad",180,1,5,0,current+1) > 0) { CloseOrder9(); } } void CloseOrder9() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis39() { if (iCustom(NULL, NULL, "mohamad",180,1,5,1,current+1) < 0) { CloseOrder36(); } } void CloseOrder36() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TrailingStop14() { for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { double takeprofit = OrderTakeProfit(); if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > TrailingStop14*PipValue*Point) { if (OrderStopLoss() < Ask-(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Ask+(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret1 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask-TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret1 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > TrailingStop14*PipValue*Point) { if (OrderStopLoss() > Bid+(TrailingStop14+TrailingGap14)*PipValue*Point) { if (NewTakeProfit14 != 0) takeprofit = Bid-(NewTakeProfit14 + TrailingStop14)*PipValue*Point; bool ret2 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid+TrailingStop14*PipValue*Point, takeprofit, OrderExpiration(), White); if (ret2 == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } } } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } void TechnicalAnalysis35() { if (iADX(NULL, NULL,9,PRICE_CLOSE,MODE_MAIN,1) < 20) { CloseOrder25(); } } void CloseOrder25() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[90][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } int deinit() { if (false) ObjectsDeleteAll(); } |
04-02-2016, 05:28 PM | المشاركة رقم: 7 | ||||||||||||||||||||||||
|
كاتب الموضوع :
sal_moh85
المنتدى :
منتدى المؤشرات و الاكسبيرتات
رد: الى استاذ اسلام ارجو المساعده
هاد الكود |
||||||||||||||||||||||||
|
#7
|
|
|
|
رد: الى استاذ اسلام ارجو المساعده
هاد الكود
|
مواقع النشر (المفضلة) |
الكلمات الدلالية (Tags) |
المساعده, ارجو, اسماء, استاذ |
|
|