المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : محتاجه ضروري اكسبريت يجعل الهدف 0.1 نقطة والاستوب لوس 3 نقاط لجميع الصفقات المفتوحه


nesma
26-12-2012, 01:06 PM
لو سمحتم يا جماعه محتاجه ضروري وبسرعه اكسبريت

يجعل الهدف 0.1 نقطة
والاستوب لوس 3 نقاط

لجميع الصفقات المفتوحه

المنصة خماسية

انا حاولت اعمله بس في حاجه غلط عندي
وده الكود




#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();


}

ٍٍالصقر
26-12-2012, 02:10 PM
[SIZE=4]لو سمحتم يا جماعه محتاجه ضروري وبسرعه اكسبريت

يجعل الهدف 0.1 نقطة
والاستوب لوس 3 نقاط



الزاى الهدف اقل من نقطة !!!!!!!!!!!
وهل المنصة اللى انتى بتشتغلى عليها بتقبل تعديل الأهداف والستوب بالأحجام ديه ؟؟ وايه المنصة اللى حضرتك بتستخدميها ؟؟

اعتقد حضرتك ممكن تعملى اكسبرت يقفل الصفقات عند تحقيق عدد نقاط معين سواء ربح او خسارة افضل
اينعم ممكن يكون فى بطئ فى تنفيذ الأوامر
لكنه افضل لإن التعديل على الصفقات بالأرقام اللى حضرتك عايزاها مش كل المنصات بتقبلة واعتقد انه اقل حاجة فى معظم المنصات 3 نقط

MemO_KinG
29-12-2012, 09:24 PM
http://www.fx-arabia.com/vb/uploaded/7202_11356805382.mq4
http://www.fx-arabia.com/vb/uploaded/7202_11356805406.ex4

ده اكسبرت تحديد الهدف و الاستوب اوتوماتيك بس بالنسبة لـ 0.1 نقطة ده مش فاهمه

و شكراً