النتائج 76 إلى 90 من 107
الموضوع: سؤال برمجى مهم جدا
- 20-07-2012, 05:24 AM #76
- 20-07-2012, 05:27 AM #77
إعتبر عملك لهذا الإكسبرت وسيله لتعلم البرمجه لأنها أفضل طريقة للتعلم السؤال والمحاوله ولا تعتبر همك الآن هو عمل إكسبرت كامل
إستمر في بناء الإكسبرت جزء جزء ولا يهم متى ستنتهي منه
قم بإرفاق آخر نسخه للإكسبرت بعد كل تطوير تحاول عمله وأخبرنا بالجزء الذي لم تستطع حله وسوف نساعدك
- 20-07-2012, 06:04 PM #78
- 21-07-2012, 02:33 AM #79
- 21-07-2012, 02:56 AM #80
رد:سؤال برمجى مهم جدا
هذا هو كود الاكسبيرت
كود PHP://+------------------------------------------------------------------+
//| Ambush |
//| Copyright, created 20 july 2012|
//| |
//| Desined by Ahmed Essam|
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Ambush"
#property link "[email protected]"
extern int MaxTrades = 1; // ---------------- 1
extern int stoploss = 50; // ---------------- 2
extern int takeprofit = 50; // ---------------- 3
extern double TrailingStop =0; // ---------------- 4
extern bool UseHourTrade = false; // ---------------- 5
extern int FromHourTrade = 7; // ---------------- 6
extern int ToHourTrade = 17; // ---------------- 7
extern string MM_Parameters = "---------- Money Management";
extern double Lots = 0.01;
extern bool MM = false, // ---------------- 8
AccountIsMicro = true;
extern int Risk = 10; // ---------------- 9
int MagicNumber=148; // -------------------- 10
extern int tenkansen=9;
extern int kijunsen=26;
extern int senkospan=52;
extern int shift=0;
extern int shift2=26;
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
Comment("");
}
int orderscnt(){
int cnt=0;
for(int i =0;i<OrdersTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()==Symbol() && MagicNumber==OrderMagicNumber()){
cnt++;
}
}
}
return(cnt);
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS Start function |
//+------------------------------------------------------------------+
int start()
{
if (UseHourTrade){
if(!(Hour()>=FromHourTrade&&Hour()<=ToHourTrade)){
Comment("Non-Trading Hours!");
return(0);
}
}
double Tenkan=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_TENKANSEN,shift);
double Kijun=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_KIJUNSEN,shift);
double Senkou=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_CHINKOUSPAN,1+kijunsen);
double Senkoua=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANA,shift);
double Senkouaplus=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANA,shift+27);
double Senkoub=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANB,shift);
double Senkoubplus=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANB,shift+27);
double Ichimoku_B=iCustom(Symbol(),0,"Ichimoku Trend Magic Histogram with Alert",1,shift);
double Ichimoku_S=iCustom(Symbol(),0,"Ichimoku Trend Magic Histogram with Alert",0,shift);
double sl,tp;
if(MM) Lots = subLotSize();
//-----------------buy&sell ----------------
if((Close[1]>Tenkan)&&(Close[1]>Kijun)&&(Close[1]>Senkoub)&&(Close[1]>Senkoua)&&(Ichimoku_B==3)&&(Senkou>Senkoubplus&&Senkou>Senkouaplus)){ // ------------------------ 22
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Ask-stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Ask+takeprofit*Point;}
OrderSend(Symbol(),OP_BUY,Lots,Ask,2,sl,tp,"Ambush",MagicNumber,0,Blue);
PlaySound("Alert.wav");
}
}
if(Close[1]<Tenkan)
{
CloseBuyOrders();
}
if ((Close[1]<Tenkan)&&(Close[1]<Kijun)&&(Close[1]<Senkoua)&&(Close[1]<Senkoub)&&(Ichimoku_S==3)&&(Senkou<Senkoubplus&&Senkou<Senkouaplus)){ // ------------------------ 23
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Bid+stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Bid-takeprofit*Point;}
OrderSend(Symbol(),OP_SELL,Lots,Bid,2,sl,tp,"Ambush",MagicNumber,0,Red);
PlaySound("Alert.wav");
}
}
if(Close[1]>Tenkan)
{
CloseBuyOrders();
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS TrailingStop |
//+------------------------------------------------------------------+
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,
OrderTakeProfit(),0,Green);
return(0);
}
}
}
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,
OrderTakeProfit(),0,Red);
return(0);
}
}
}
return(0);
}
void CloseBuyOrders()
{
for (int cnt = 0 ; cnt < OrdersTotal() ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == MagicNumber && OrderSymbol()==Symbol())
{
if (OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3);
}
}
}
}
void CloseSellOrders()
{
for (int cnt = 0 ; cnt < OrdersTotal() ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == MagicNumber && OrderSymbol()==Symbol())
{
if (OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3);
}
}
}
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS Money Managment |
//+------------------------------------------------------------------+
double subLotSize()
{
double lotMM = MathCeil(AccountFreeMargin() * Risk / 1000) / 100;
if(AccountIsMicro==false)
{
if(lotMM < 0.1) lotMM = Lots;
if((lotMM > 0.5) && (lotMM < 1)) lotMM = 0.5;
if(lotMM > 1.0) lotMM = MathCeil(lotMM);
if(lotMM > 100) lotMM = 100;
}
else
{
if(lotMM < 0.01) lotMM = Lots;
if(lotMM > 1.0) lotMM = MathCeil(lotMM);
if(lotMM > 100) lotMM = 100;
}
return (lotMM);
}
//+---------------------------------------------------------------------------------+
- 21-07-2012, 03:20 AM #81
السلام عليكم اخي احمد انت لم تستخدم الدالة CloseSellOrdersفي الاكسبريت لذا حذفها
- 21-07-2012, 03:26 AM #82
رد:سؤال برمجى مهم جدا
كود PHP:if((Close[1]>Tenkan)&&(Close[1]>Kijun)&&(Close[1]>Senkoub)&&(Close[1]>Senkoua)&&(Ichimoku_B==3)&&(Senkou>Senkoubplus&&Senkou>Senkouaplus)){ // ------------------------ 22
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Ask-stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Ask+takeprofit*Point;}
OrderSend(Symbol(),OP_BUY,Lots,Ask,2,sl,tp,"Ambush",MagicNumber,0,Blue);
PlaySound("Alert.wav");
}
}
if(Close[1]<Tenkan)
{
CloseBuyOrders();
}
if ((Close[1]<Tenkan)&&(Close[1]<Kijun)&&(Close[1]<Senkoua)&&(Close[1]<Senkoub)&&(Ichimoku_S==3)&&(Senkou<Senkoubplus&&Senkou<Senkouaplus)){ // ------------------------ 23
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Bid+stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Bid-takeprofit*Point;}
OrderSend(Symbol(),OP_SELL,Lots,Bid,2,sl,tp,"Ambush",MagicNumber,0,Red);
PlaySound("Alert.wav");
}
}
if(Close[1]>Tenkan)
{
CloseBuyOrders();
}
انت استخدمت دالة اغلاق الشراء مرتين CloseBuyOrders
والصحيح ان تستخدم مرة دالة اغلاق البيع ومرة دالة اغلاق الشراء حسب فكرة الاكسبريت
- 21-07-2012, 03:40 AM #83
- 21-07-2012, 03:57 AM #84
دقيقة احاول فهم ما قلت برمجيا
- 21-07-2012, 04:00 AM #85
- 21-07-2012, 04:01 AM #86
يعني في حالة sell الشرط اغلاق الشمعة فوق التنكن
وفي حالة buy الشرط اغلاق الشمعة تحت التنكن
- 21-07-2012, 04:02 AM #87
- 21-07-2012, 04:08 AM #88
رد:سؤال برمجى مهم جدا
بسيطة خطئ صغير جدا انا صلحته
كود PHP://+------------------------------------------------------------------+
//| Ambush |
//| Copyright, created 20 july 2012|
//| |
//| Desined by Ahmed Essam|
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Ambush"
#property link "[email protected]"
extern int MaxTrades = 1; // ---------------- 1
extern int stoploss = 50; // ---------------- 2
extern int takeprofit = 50; // ---------------- 3
extern double TrailingStop =0; // ---------------- 4
extern bool UseHourTrade = false; // ---------------- 5
extern int FromHourTrade = 7; // ---------------- 6
extern int ToHourTrade = 17; // ---------------- 7
extern string MM_Parameters = "---------- Money Management";
extern double Lots = 0.01;
extern bool MM = false, // ---------------- 8
AccountIsMicro = true;
extern int Risk = 10; // ---------------- 9
int MagicNumber=148; // -------------------- 10
extern int tenkansen=9;
extern int kijunsen=26;
extern int senkospan=52;
extern int shift=0;
extern int shift2=26;
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
Comment("");
}
int orderscnt(){
int cnt=0;
for(int i =0;i<OrdersTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()==Symbol() && MagicNumber==OrderMagicNumber()){
cnt++;
}
}
}
return(cnt);
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS Start function |
//+------------------------------------------------------------------+
int start()
{
if (UseHourTrade){
if(!(Hour()>=FromHourTrade&&Hour()<=ToHourTrade)){
Comment("Non-Trading Hours!");
return(0);
}
}
double Tenkan=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_TENKANSEN,shift);
double Kijun=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_KIJUNSEN,shift);
double Senkou=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_CHINKOUSPAN,1+kijunsen);
double Senkoua=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANA,shift);
double Senkouaplus=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANA,shift+27);
double Senkoub=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANB,shift);
double Senkoubplus=iIchimoku(NULL,0,tenkansen,kijunsen,senkospan,MODE_SENKOUSPANB,shift+27);
double Ichimoku_B=iCustom(Symbol(),0,"Ichimoku Trend Magic Histogram with Alert",1,shift);
double Ichimoku_S=iCustom(Symbol(),0,"Ichimoku Trend Magic Histogram with Alert",0,shift);
double sl,tp;
if(MM) Lots = subLotSize();
//-----------------buy&sell ----------------
if((Close[1]>Tenkan)&&(Close[1]>Kijun)&&(Close[1]>Senkoub)&&(Close[1]>Senkoua)&&(Ichimoku_B==3)&&(Senkou>Senkoubplus&&Senkou>Senkouaplus)){ // ------------------------ 22
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Ask-stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Ask+takeprofit*Point;}
OrderSend(Symbol(),OP_BUY,Lots,Ask,2,sl,tp,"Ambush",MagicNumber,0,Blue);
PlaySound("Alert.wav");
}
}
if(Close[1]<Tenkan)
{
CloseBuyOrders();
}
if ((Close[1]<Tenkan)&&(Close[1]<Kijun)&&(Close[1]<Senkoua)&&(Close[1]<Senkoub)&&(Ichimoku_S==3)&&(Senkou<Senkoubplus&&Senkou<Senkouaplus)){ // ------------------------ 23
if(orderscnt()<MaxTrades){
if(stoploss==0){sl=0;}else{sl=Bid+stoploss*Point;}
if(takeprofit==0){tp=0;}else{tp=Bid-takeprofit*Point;}
OrderSend(Symbol(),OP_SELL,Lots,Bid,2,sl,tp,"Ambush",MagicNumber,0,Red);
PlaySound("Alert.wav");
}
}
if(Close[1]>Tenkan)
{
CloseSellOrders();
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS TrailingStop |
//+------------------------------------------------------------------+
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,
OrderTakeProfit(),0,Green);
return(0);
}
}
}
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,
OrderTakeProfit(),0,Red);
return(0);
}
}
}
return(0);
}
void CloseBuyOrders()
{
for (int cnt = 0 ; cnt < OrdersTotal() ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == MagicNumber && OrderSymbol()==Symbol())
{
if (OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3);
}
}
}
}
void CloseSellOrders()
{
for (int cnt = 0 ; cnt < OrdersTotal() ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == MagicNumber && OrderSymbol()==Symbol())
{
if (OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3);
}
}
}
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS Money Managment |
//+------------------------------------------------------------------+
double subLotSize()
{
double lotMM = MathCeil(AccountFreeMargin() * Risk / 1000) / 100;
if(AccountIsMicro==false)
{
if(lotMM < 0.1) lotMM = Lots;
if((lotMM > 0.5) && (lotMM < 1)) lotMM = 0.5;
if(lotMM > 1.0) lotMM = MathCeil(lotMM);
if(lotMM > 100) lotMM = 100;
}
else
{
if(lotMM < 0.01) lotMM = Lots;
if(lotMM > 1.0) lotMM = MathCeil(lotMM);
if(lotMM > 100) lotMM = 100;
}
return (lotMM);
}
//+---------------------------------------------------------------------------------+
- 21-07-2012, 04:36 AM #89
- 21-07-2012, 04:50 AM #90