[Toute question de débutant, afin de ne pas encombrer le forum. Professionnels, ne passez pas votre chemin. Je ne peux aller nulle part sans toi. - page 597

 
Craft:

Bonjour, je continue à me familiariser avec le codage, j'ai pris l'exemple EA de l'article de la section tutoriel, j'ai remplacé le code de l'exemple :

A un arbitraire à des fins de formation :

Les transactions ne s'affichent pas, pourriez-vous me dire quelle est la raison, comment corriger le code.


double MA_1[]; // нет обьявления размера, не видно как (локально или глобально) обьявлен, 
// не видно оператора двигающего индекс массива.
// лучше пока не освоили работу с массивами обьявите переменные и не парьтесь

  double MA_0=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,0);
  double MA_1=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,1);
  
  if (MA_1 < MA_0)
     {                                          // ..МА последнего бара выше предыдущего
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
   if (MA_1 > MA_0)
     {                                          // ..МА последнего бара ниже предыдущего
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }
 

Urain, merci, je ne cesse d'être étonné par la logique de mql, et si vous essayez d'utiliser for(int i=1 ; pour essayer, le script ne se simplifiera pas - pourriez-vous me dire comment le mettre en forme, je ne peux pas encore sentir la logique du langage, comment définir l'opérateur qui déplace le tableau ?

P. S. J'ai déclaré le tableau, par erreur dans l'exemple de script a supprimé :

   double MA_1[];
   ArrayResize(MA_1,Period_MA);

   MA_1[0]=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,0);

   if (MA_1[1] < MA_1[0])
     {                                          // 
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
   if (MA_1[1] > MA_1[0])
     {                                          // 
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }
 
Abzasc:
Différences de prix. En conséquence, les résultats des indicateurs sont différents, au contraire...
Je n'y vois rien de différent. Oubliez les indicateurs, une fois de plus, le bon pour vous est celui sur lequel vous tradez. Tu ne te concentres pas du tout sur le bon.
 
#propriété indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 blue
#property indicator_color2 Red

extern int n = 20 ;
extern int t3_period = 5 ;
double externe b = 0.618 ;
extern int mBars = 300 ;
extern int Bars.Count = 0 ;
int i,t,c ;
double Buf1[],Buf2[],CF_p[5001],CF_n[5001],Ch_p[5001],Ch_n[5001],k_n,k_p,ch_p,ch_n,cff_p,cff_n,
AcBars,t3,t32,A1,A2,b2,b3,c1,c2,c3,c4,e1,e2,e3,e4,e5,e6,n1,w1,w2,e12,e22,e32,e42,e52,e62;


//+------------------------------------------------------------------+
int init() {
SetIndexStyle(0, DRAW_LINE) ;
SetIndexBuffer(0, Buf1) ;
SetIndexStyle(1, DRAW_LINE) ;
SetIndexBuffer(1, Buf2) ;
return(0) ; }
//+------------------------------------------------------------------+
int start() {
int limite ;
si (IndicatorCounted()<0) return(-1) ;
limit=Bars-IndicatorCounted() ;
si (Bars.Count>0 && limit>Bars.Count) limit=Bars.Count ;
for(int i=0 ; i<limit ; i++)
{

b2=b*b ; b3=b2*b ; c1=-b3 ; c2=(3*(b2+b3)) ; c3=-3*(2*b2+b3) ; c4=(1+3*b+b3+3*b2) ; n1=t3_period ;

si(n1<1) n1=1 ; n1=1+0.5*(n1-1) ; w1=2/(n1+1) ; w2=1-w1 ;

if(AcBars==0) AcBars=Bars-mBars ;

for(c=AcBars ; c<=Bars-1 ; c +++) { i=Bars-1-c ; {

if(Close[i]>Close[i+1]) { Ch_p[i]=Close[i]-Close[i+1] ; CF_p[i]=Ch_p[i]+CF_p[i+1] ; Ch_n[i]=0 ; CF_n[i]=0 ; }
else { Ch_p[i]=0 ; CF_p[i]=0 ; Ch_n[i]=Close[i+1]-Close[i] ; CF_n[i]=Ch_n[i]+CF_n[i+1] ; }}

for(t=i+n ; t>=i ; t--) { ch_p=Ch_p[t]+ch_p ; ch_n=Ch_n[t]+ch_n ; cff_p=CF_p[t]+cff_p ; cff_n=CF_n[t]+cff_n ; }

k_p=ch_p-cff_n; k_n=ch_n-cff_p;

A1=k_p ; e1=w1*A1+w2*e1 ; e2=w1*e1+w2*e2 ; e3=w1*e2+w2*e3 ; e4=w1*e3+w2*e4 ;
e5=w1*e4+w2*e5 ; e6=w1*e5+w2*e6 ; t3=c1*e6+c2*e5+c3*e4+c4*e3 ; Buf1[i]=t3 ;

A2=k_n ; e12=w1*A2+w2*e12 ; e22=w1*e12+w2*e22 ; e32=w1*e22+w2*e32 ; e42=w1*e32+w2*e42 ;
e52=w1*e42+w2*e52 ; e62=w1*e52+w2*e62 ; t32=c1*e62+c2*e52+c3*e42+c4*e32 ; Buf2[i]=t32 ;

AcBars=AcBars+1 ; ch_p=0 ; ch_n=0 ; cff_p=0 ; cff_n=0 ; }
}

return(0) ; }


Pouvez-vous me dire où l'erreur n'est pas mise à jour, l'historique est normal et celui en ligne ne l'est pas.

Dossiers :
 

Bon après-midi. Un tableau a été déclaré, l'opérateur qui déplace l'indice du tableau a été défini, mais les commandes ne sont pas passées. S'il vous plaît, dites-moi ce qui ne va pas.

   double MA_1[];
   ArrayResize(MA_1,Period_MA);

   for(int j=0;j<=Period_MA-1;j++)
   MA_1[j]=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,j);

   
   if (MA_1[j+1] < MA_1[j])
     {                                          // 
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
   if (MA_1[j+1] > MA_1[j])
     {                                          // 
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }
 

EssayezOrderSend, alors ça marche...

Avez-vous lu l'aide standard de MetaEditore ? Si ce n'est pas le cas, lisez l'intégralité...

Craft:

Bon après-midi. J'ai déclaré un tableau et défini l'opérateur qui déplace l'indice du tableau, mais les commandes ne sont pas passées. S'il vous plaît, dites-moi ce qui ne va pas.

 
Pouvez-vous me dire s'il est possible de réécrire la fonction d'Igor Kim, qui ferme tous les ordres perdants, dont la perte dépasse une certaine valeur :
.
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 25.04.2008                                                     |
//|  Описание : Закрытие тех позиций, у которых убыток в валюте депозита       |
//|             превысил некоторое значение                                    |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|    op - операция                   (-1   - любая позиция)                  |
//|    mn - MagicNumber                (-1   - любой магик)                    |
//|    pr - профит/убыток                                                      |
//+----------------------------------------------------------------------------+
void ClosePosBySizeLossInCurrency(string sy="", int op=-1, int mn=-1, double pr=0) {
  int i, k=OrdersTotal();

  if (sy=="0") sy=Symbol();
  for (i=k-1; i>=0; i--) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if ((OrderSymbol()==sy || sy=="") && (op<0 || OrderType()==op)) {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (mn<0 || OrderMagicNumber()==mn) {
            if (OrderProfit()+OrderSwap()<-MathAbs(pr)) ClosePosBySelect();
          }
        }
      }
    }
  }
}
J'ai besoin de trouver une position ouverte qui a la plus grande perte.
Le point est que je dois trouver la position avec plus de profit que celle qui perd et les fermer en contre-fermeture.
Peut-être que quelqu'un a une expérience à ce sujet, ou a été confronté à un tel problème ?
 
Pourquoi trois indicateurs basés sur des principes différents ne peuvent-ils pas montrer presque la même image (spearman, stochastique et mcdrsy) - mais ne peuvent pas montrer le bon mouvement et l'entrée avec une probabilité supérieure à 60% ?
 
Bonjour, je me demande quel code est nécessaire pour fermer un ordre après qu'il ait dépassé le point X de profit et qu'il ait commencé à descendre jusqu'au point Y>OrderOpenPrice et qu'il doive ensuite le fermer.
 
StatBars:

Essayez OrderSend, alors ça marche...

Avez-vous lu l'aide standard de MetaEditore ? Si non, lisez tout...


D'âge enfantin pour poser une question sans s'être adressé à l'aide et yandex ont grandi. Il y a beaucoup d'envois, mais les postes ne sont pas ouverts :

double MA_1[];
   ArrayResize(MA_1,Period_MA);

   for(int j=0;j<=Period_MA-1;j++)
   MA_1[j]=iMA(NULL,0,Period_MA,0,MODE_EMA,PRICE_CLOSE,j);

   
   if (MA_1[j+1] < MA_1[j])
     {                                          // 
      Opn_B=true;                               // Критерий откр. Buy
      Cls_S=true;                               // Критерий закр. Sell
     }
   if (MA_1[j+1] > MA_1[j])
     {                                          // 
      Opn_S=true;                               // Критерий откр. Sell
      Cls_B=true;                               // Критерий закр. Buy
     }
   // Открытие ордеров
   while(true)                                  // Цикл закрытия орд.
     {
      if (Total==0 && Opn_B==true)              // Открытых орд. нет +
        {                                       // критерий откр. Buy
         RefreshRates();                        // Обновление данных
         SL=Bid - New_Stop(StopLoss);     // Вычисление SL откр.
         TP=Bid + New_Stop(TakeProfit);   // Вычисление TP откр.
         Alert("Попытка открыть Buy. Ожидание ответа..");
         Ticket=OrderSend(Symb,OP_BUY,Lts,Ask,2,SL,TP);//Открытие Buy
         if (Ticket > 0)                        // Получилось :)
           {
            Alert ("Открыт ордер Buy ",Ticket);
            return;                             // Выход из start()
           }
         if (Fun_Error(GetLastError())==1)      // Обработка ошибок
            continue;                           // Повторная попытка
         return;                                // Выход из start()
        }
      if (Total==0 && Opn_S==true)              // Открытых орд. нет +
        {                                       // критерий откр. Sell
         RefreshRates();                        // Обновление данных
         SL=Ask + New_Stop(StopLoss);     // Вычисление SL откр.
         TP=Ask - New_Stop(TakeProfit);   // Вычисление TP откр.
         Alert("Попытка открыть Sell. Ожидание ответа..");
         Ticket=OrderSend(Symb,OP_SELL,Lts,Bid,2,SL,TP);//Открытие Sel
         if (Ticket > 0)                        // Получилось :)
           {
            Alert ("Открыт ордер Sell ",Ticket);
            return;                             // Выход из start()
           }
         if (Fun_Error(GetLastError())==1)      // Обработка ошибок
            continue;                           // Повторная попытка
         return;                                // Выход из start()
        }
      break;                                    // Выход из while
     }