لو سمحتم يا جماعه محتاجه ضروري وبسرعه اكسبريت
يجعل الهدف 0.1 نقطة
والاستوب لوس 3 نقاط
لجميع الصفقات المفتوحه
المنصة خماسية
انا حاولت اعمله بس في حاجه غلط عندي
وده الكود
[PHP]
#property copyright "Copyright © 2013,NESMA"
#include <stdlib.mqh>
#include <WinUser32.mqh>
// exported variables
extern double SellLots7 = 0.01;
extern int SellStoploss7 = 3;
extern double SellTakeprofit7 = 1.2;
extern int SellStoploss9 = 3;
extern double SellTakeprofit9 = 0.3;
extern double BuyLots3 = 0.01;
extern int BuyStoploss3 = 3;
extern double BuyTakeprofit3 = 1.2;
extern int BuyStoploss8 = 3;
extern double BuyTakeprofit8 = 0.3;
// 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 ExecuteCount5 = 5;
int ExecuteCountCurrent5 = 2;
int ExecuteCount6 = 5;
int ExecuteCountCurrent6 = 2;
int init()
{
NDigits = Digits;
if (false) ObjectsDeleteAll(); // clear the chart
ExecuteCountCurrent5 = ExecuteCount5;
ExecuteCountCurrent6 = ExecuteCount6;
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);
}
OnEveryTick1();
}
void OnEveryTick1()
{
if (true == false && false) PipValue = 10;
if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;
ExecuteNTimes5();
ExecuteNTimes6();
}
void ExecuteNTimes5()
{
if (0 == 0)
{
ExecuteCountCurrent5 = ExecuteCount5;
}
if (ExecuteCountCurrent5 > 0)
{
ExecuteCountCurrent5--;
SellOrder7();
}
}
void SellOrder7()
{
double SL = Bid + SellStoploss7*PipValue*Point;
if (SellStoploss7 == 0) SL = 0;
double TP = Bid - SellTakeprofit7*PipValue*Point;
if (SellTakeprofit7 == 0) TP = 0;
int ticket = -1;
ticket = OrderSend(Symbol(), OP_SELL, SellLots7, Bid, 4, SL, TP, "My Expert", ExecuteCountCurrent5, 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()));
}
SellOrderModify9();
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void SellOrderModify9()
{
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == ExecuteCountCurrent5)
{
double price = Bid;
if (true == false)
{
price = OrderOpenPrice();
}
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), price + SellStoploss9*PipValue*Point, price - SellTakeprofit9*PipValue*Point, 0, White);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
void ExecuteNTimes6()
{
if (0 == 0)
{
ExecuteCountCurrent6 = ExecuteCount6;
}
if (ExecuteCountCurrent6 > 0)
{
ExecuteCountCurrent6--;
BuyOrder3();
}
}
void BuyOrder3()
{
double SL = Ask - BuyStoploss3*PipValue*Point;
if (BuyStoploss3 == 0) SL = 0;
double TP = Ask + BuyTakeprofit3*PipValue*Point;
if (BuyTakeprofit3 == 0) TP = 0;
int ticket = -1;
ticket = OrderSend(Symbol(), OP_BUY, BuyLots3, Ask, 4, SL, TP, "My Expert", ExecuteCountCurrent6, 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()));
}
BuyOrderModify8();
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void BuyOrderModify8()
{
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == ExecuteCountCurrent6)
{
double price = Ask;
if (true == false)
{
price = OrderOpenPrice();
}
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), price - BuyStoploss8*PipValue*Point, price + BuyTakeprofit8*PipValue*Point, 0, White);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
int deinit()
{
if (false) ObjectsDeleteAll();
}
[/PHP]
يجعل الهدف 0.1 نقطة
والاستوب لوس 3 نقاط
لجميع الصفقات المفتوحه
المنصة خماسية
انا حاولت اعمله بس في حاجه غلط عندي
وده الكود
[PHP]
#property copyright "Copyright © 2013,NESMA"
#include <stdlib.mqh>
#include <WinUser32.mqh>
// exported variables
extern double SellLots7 = 0.01;
extern int SellStoploss7 = 3;
extern double SellTakeprofit7 = 1.2;
extern int SellStoploss9 = 3;
extern double SellTakeprofit9 = 0.3;
extern double BuyLots3 = 0.01;
extern int BuyStoploss3 = 3;
extern double BuyTakeprofit3 = 1.2;
extern int BuyStoploss8 = 3;
extern double BuyTakeprofit8 = 0.3;
// 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 ExecuteCount5 = 5;
int ExecuteCountCurrent5 = 2;
int ExecuteCount6 = 5;
int ExecuteCountCurrent6 = 2;
int init()
{
NDigits = Digits;
if (false) ObjectsDeleteAll(); // clear the chart
ExecuteCountCurrent5 = ExecuteCount5;
ExecuteCountCurrent6 = ExecuteCount6;
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);
}
OnEveryTick1();
}
void OnEveryTick1()
{
if (true == false && false) PipValue = 10;
if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;
ExecuteNTimes5();
ExecuteNTimes6();
}
void ExecuteNTimes5()
{
if (0 == 0)
{
ExecuteCountCurrent5 = ExecuteCount5;
}
if (ExecuteCountCurrent5 > 0)
{
ExecuteCountCurrent5--;
SellOrder7();
}
}
void SellOrder7()
{
double SL = Bid + SellStoploss7*PipValue*Point;
if (SellStoploss7 == 0) SL = 0;
double TP = Bid - SellTakeprofit7*PipValue*Point;
if (SellTakeprofit7 == 0) TP = 0;
int ticket = -1;
ticket = OrderSend(Symbol(), OP_SELL, SellLots7, Bid, 4, SL, TP, "My Expert", ExecuteCountCurrent5, 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()));
}
SellOrderModify9();
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void SellOrderModify9()
{
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == ExecuteCountCurrent5)
{
double price = Bid;
if (true == false)
{
price = OrderOpenPrice();
}
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), price + SellStoploss9*PipValue*Point, price - SellTakeprofit9*PipValue*Point, 0, White);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
void ExecuteNTimes6()
{
if (0 == 0)
{
ExecuteCountCurrent6 = ExecuteCount6;
}
if (ExecuteCountCurrent6 > 0)
{
ExecuteCountCurrent6--;
BuyOrder3();
}
}
void BuyOrder3()
{
double SL = Ask - BuyStoploss3*PipValue*Point;
if (BuyStoploss3 == 0) SL = 0;
double TP = Ask + BuyTakeprofit3*PipValue*Point;
if (BuyTakeprofit3 == 0) TP = 0;
int ticket = -1;
ticket = OrderSend(Symbol(), OP_BUY, BuyLots3, Ask, 4, SL, TP, "My Expert", ExecuteCountCurrent6, 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()));
}
BuyOrderModify8();
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void BuyOrderModify8()
{
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == ExecuteCountCurrent6)
{
double price = Ask;
if (true == false)
{
price = OrderOpenPrice();
}
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), price - BuyStoploss8*PipValue*Point, price + BuyTakeprofit8*PipValue*Point, 0, White);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
int deinit()
{
if (false) ObjectsDeleteAll();
}
[/PHP]