EA'm çift giriş yapıyor - sayfa 11

 

Bu başlıkta 1. başlık olarak görünen güncellemeler olduğunu sanıyordum.

bu yüzden hala hizmet masasından herhangi bir güncelleme olmadığına inanıyorum, değil mi?

 

Merhaba. Çift girişle ilgili bir sorunum var (beklenmedik bir şekilde :)). Lütfen, sorunuma yardım eder misin? Bu konuda genellikle uyku() işlevine bakın, ancak nerede kullanılacağını bilmiyorum.

Bu benim programım:

 //+------------------------------------------------------------------+
//| Externí vstupní parametry strategie                              |
//+------------------------------------------------------------------+
extern double Stoploss_v_pipech = 1000 ; // definice stop lossu
extern double Profit_target_v_pipech = 2000 ; // definice profit targetu
extern double Velikost_pozice = 0.01 ; // definice velikosti pozice pro obchodování
extern double ADXP = 14 ;
extern double LMAP = 21 ;
extern double SMAP = 5 ;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  { return ( 0 );}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  { return ( 0 );}
//+------------------------------------------------------------------+
//| Expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//+------------------------------------------------------------------+
//| Definice proměnných                                              |
//+------------------------------------------------------------------+
   int D = DayOfWeek();                       // zjistí den v týdnu (neděle=0 … pátek=5)
   int m = TimeMinute( TimeCurrent ());         // zjistí aktuální minutu
   int h = TimeHour( TimeCurrent ());           // zjistí aktuální hodinu
   int ticket, q, p, close;                   // proměnná pro zadání příkazu, počítadlo
   int maxDuration = 5 * 60 ;
   int duration = TimeCurrent () - OrderOpenTime();
   double aLMA = iMA ( Symbol (), PERIOD_M1 ,LMAP, 0 , MODE_LWMA , PRICE_CLOSE , 2 );
   double bLMA = iMA ( Symbol (), PERIOD_M1 ,LMAP, 0 , MODE_LWMA , PRICE_CLOSE , 1 );
   double aSMA = iMA ( Symbol (), PERIOD_M1 ,SMAP, 0 , MODE_LWMA , PRICE_CLOSE , 2 );
   double bSMA = iMA ( Symbol (), PERIOD_M1 ,SMAP, 0 , MODE_LWMA , PRICE_CLOSE , 1 );
   double ADX = iADX ( Symbol (), PERIOD_M1 ,ADXP, PRICE_CLOSE , 0 , 1 );
   double SL = Stoploss_v_pipech* Point ;       // převod pipového stoplossu na cenové vyjádření
   double PT = Profit_target_v_pipech* Point ;   // převod pipového profitu na cenové vyjádření
   int Magic_number = 1001 ;                   // identifikační číslo strategie
   string Text = "Moje první strategie" ;       // komentář  

//+------------------------------------------------------------------+
//| Výstup kontraktů                                                 |
//+------------------------------------------------------------------+
for (p = 0 ;p < OrdersTotal ();p++)
{ if ( OrderSelect (p, SELECT_BY_POS, MODE_TRADES)== true && OrderMagicNumber()==Magic_number && duration > maxDuration)   //&& duration > maxDuration)
   { if (OrderType()==OP_BUY) {close=OrderClose(OrderTicket(),Velikost_pozice,Bid, 2 ,Yellow);}
     if (OrderType()==OP_SELL) {close=OrderClose(OrderTicket(),Velikost_pozice,Ask, 2 ,Yellow);}}}

//+------------------------------------------------------------------+
//| Omezovač počtu vstupů                                            |
//+------------------------------------------------------------------+
for (q = 0 ; q < OrdersTotal (); q++)
    { if ( OrderSelect (q, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber()==Magic_number)
    { return ( 0 );}}
//+------------------------------------------------------------------+
//| Podmínka pro prodej (SELL/SHORT)                                 |
//+------------------------------------------------------------------+
if (D >= 1 && D < 5 && aLMA < aSMA && bLMA > bSMA && ADX > 25 )
   {ticket = OrderSend ( Symbol (),OP_SELL,Velikost_pozice,Bid, 0 ,Bid+SL,Bid-PT,Text, Magic_number, 0 ,Red);}
   

//+------------------------------------------------------------------+
//| Podmínka pro nákup (BUY/LONG)                                    |
//+------------------------------------------------------------------+
if (D >= 1 && D < 5 && aLMA > aSMA && bLMA < bSMA && ADX > 25 )
   {ticket = OrderSend ( Symbol (),OP_BUY,Velikost_pozice,Ask, 0 ,Ask-SL,Ask+PT,Text, Magic_number, 0 ,Blue);}
  

return ( 0 );}
 
topas :

Merhaba. Çift girişle ilgili bir sorunum var (beklenmedik bir şekilde :)). Lütfen, sorunuma yardım eder misin? Bu konuda genellikle uyku() işlevine bakın, ancak nerede kullanılacağını bilmiyorum.

Bu benim programım:

Bu konu mql5 ile ilgilidir, mql4 ile ilgili değildir.
 
topas :

Merhaba. Çift girişle ilgili bir sorunum var (beklenmedik bir şekilde :)). Lütfen, sorunuma yardım eder misin? Bu konuda genellikle uyku() işlevine bakın, ancak nerede kullanılacağını bilmiyorum.

Bu benim programım:

Ticaret, otomatik ticaret sistemleri ve ticaret stratejilerinin test edilmesi hakkında forum

2 siparişi aç

Wahoo , 2014.11.18 15:38

 //+------------------------------------------------------------------+

//| Externí vstupní parametry strategie                              |

//+------------------------------------------------------------------+

   extern double Stoploss_v_pipech= 1000 ; // definice stop lossu

   extern double Profit_target_v_pipech= 2000 ; // definice profit targetu

   extern double Velikost_pozice= 0.01 ; // definice velikosti pozice pro obchodování

   extern double ADXP= 14 ;

   extern double LMAP= 21 ;

   extern double SMAP= 5 ;

//+------------------------------------------------------------------+

//| Expert initialization function                                      |

//+------------------------------------------------------------------+

   int init()

     { return ( 0 );}

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

   int deinit()

     { return ( 0 );}
//+------------------------------------------------------------------+

//| Expert start function                                            |

//+------------------------------------------------------------------+

   int start()

     {

       //+------------------------------------------------------------------+

       //| Definice proměnných                                              |

       //+------------------------------------------------------------------+

       int D=DayOfWeek();                       // zjistí den v týdnu (neděle=0 … pátek=5)

       int m=TimeMinute( TimeCurrent ());         // zjistí aktuální minutu

       int h=TimeHour( TimeCurrent ());           // zjistí aktuální hodinu

       int ticket,q,p,close;                   // proměnná pro zadání příkazu, počítadlo

       int maxDuration= 5 * 60 ;

       double aLMA= iMA ( Symbol (), PERIOD_M1 ,LMAP, 0 , MODE_LWMA , PRICE_CLOSE , 2 );

       double bLMA= iMA ( Symbol (), PERIOD_M1 ,LMAP, 0 , MODE_LWMA , PRICE_CLOSE , 1 );

       double aSMA= iMA ( Symbol (), PERIOD_M1 ,SMAP, 0 , MODE_LWMA , PRICE_CLOSE , 2 );

       double bSMA= iMA ( Symbol (), PERIOD_M1 ,SMAP, 0 , MODE_LWMA , PRICE_CLOSE , 1 );

       double ADX= iADX ( Symbol (), PERIOD_M1 ,ADXP, PRICE_CLOSE , 0 , 1 );

       double SL=Stoploss_v_pipech* Point ;       // převod pipového stoplossu na cenové vyjádření

       double PT=Profit_target_v_pipech* Point ;   // převod pipového profitu na cenové vyjádření

       int Magic_number= 1001 ;                   // identifikační číslo strategie

       string Text= "5 minutes EA" ;       // komentář  

       //+------------------------------------------------------------------+

       //| Výstup kontraktů                                                 |

       //+------------------------------------------------------------------+

       for (p= 0 ;p< OrdersTotal ();p++)

        {
         if ( OrderSelect (p,SELECT_BY_POS,MODE_TRADES)== true && OrderMagicNumber()==Magic_number)
           {
             int duration= TimeCurrent ()-OrderOpenTime();
             if (duration>maxDuration)
              {
                 {
                   if (OrderType()==OP_BUY) {close=OrderClose(OrderTicket(),Velikost_pozice,Bid, 2 ,Yellow);}

                   if (OrderType()==OP_SELL) {close=OrderClose(OrderTicket(),Velikost_pozice,Ask, 2 ,Yellow);}
                 }
              }
           }
        }

       //+------------------------------------------------------------------+

       //| Omezovač počtu vstupů                                            |

       //+------------------------------------------------------------------+

       for (q= 0 ; q< OrdersTotal (); q++)

        {
         if ( OrderSelect (q,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==Magic_number)

           { return ( 0 );}
        }

       //+------------------------------------------------------------------+

       //| Podmínka pro prodej (SELL/SHORT)                                 |

       //+------------------------------------------------------------------+

       if (D>= 1 && D< 5 && aLMA<aSMA && bLMA>bSMA && ADX> 25 )

        {ticket= OrderSend ( Symbol (),OP_SELL,Velikost_pozice,Bid, 0 ,Bid+SL,Bid-PT,Text,Magic_number, 0 ,Red);}


       //+------------------------------------------------------------------+

       //| Podmínka pro nákup (BUY/LONG)                                    |

       //+------------------------------------------------------------------+

       if (D>= 1 && D< 5 && aLMA>aSMA && bLMA<bSMA && ADX> 25 )

        {ticket= OrderSend ( Symbol (),OP_BUY,Velikost_pozice,Ask, 0 ,Ask-SL,Ask+PT,Text,Magic_number, 0 ,Blue);}

       return ( 0 );
     }