[Archive] Rédiger un conseiller gratuitement - page 21

 
Vinin >>:

Лучше убери. Смесь ломанного и еще неизвестно чего. Жуткая вещь получается. Хотя можешь в читабельный вид перевести.


Le conseiller expert ne fonctionne qu'en mode achat.

Veuillez faire en sorte que cela fonctionne également en vente avec les commandes en cours.


L'essence du travail : à une distance de 50 pps du prix actuel, fixez le Stop d'achat et la Limite d'achat avec un TP 100.

deux ordres à intervalles de 50 pps depuis le bas et 2 ordres depuis le haut.

Le Conseiller Expert fonctionne de telle manière qu'il doit toujours y avoir au moins 2 ordres en attente dans les deux sens.


Merci d'avance :)
#property copyright "Slobodyan Oleg"
#property link      "http://www.metaquotes.net"

extern int Orders = 2;
extern double Lots = 0.01;
extern double StepLevel = 50.0;
extern int StopLoss = 3000;
extern int Profit = 100;
double gd_104 = 0.0;

int CheckBS() {
   double l_ord_open_price_12;
   double ld_20 = 0;
   int l_count_8 = 0;
   int l_ord_total_0 = OrdersTotal();
   for (int l_pos_4 = 0; l_pos_4 < l_ord_total_0; l_pos_4++) {
      if (OrderSelect( l_pos_4, SELECT_BY_POS, MODE_TRADES) == TRUE) {
         if (OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_BUYSTOP && OrderMagicNumber() == 1) {
            if (OrderOpenPrice() - Ask > ld_20 && OrderOpenPrice() - Ask > 0.0) {
               ld_20 = OrderOpenPrice() - Ask;
               l_ord_open_price_12 = OrderOpenPrice();
               l_count_8++;
            }
         }
      }
   }
   if ( l_count_8 == 0) {
      l_ord_open_price_12 = NormalizeDouble(Bid - StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_SELLSTOP, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 1, 0, Navy);
   }
   if ( l_count_8 < Orders && l_count_8 != 0) {
      l_ord_open_price_12 = NormalizeDouble( l_ord_open_price_12 + StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_SELLSTOP, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 1, 0, Navy);
   }
   return (1);
}

int CheckBL() {
   double l_ord_open_price_12;
   double ld_20 = 0;
   int l_count_8 = 0;
   int l_ord_total_0 = OrdersTotal();
   for (int l_pos_4 = 0; l_pos_4 < l_ord_total_0; l_pos_4++) {
      if (OrderSelect( l_pos_4, SELECT_BY_POS, MODE_TRADES) == TRUE) {
         if (OrderSymbol() == Symbol() && OrderType() == OP_SELL || OrderType() == OP_SELLLIMIT && OrderMagicNumber() == 2) {
            if (Bid - OrderOpenPrice() > ld_20 && Bid - OrderOpenPrice() > 0.0) {
               ld_20 = Bid - OrderOpenPrice();
               l_ord_open_price_12 = OrderOpenPrice();
               l_count_8++;
            }
         }
      }
   }
   if ( l_count_8 == 0) {
      l_ord_open_price_12 = NormalizeDouble(Ask - StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_BUYLIMIT, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 2, 0, Navy);
   }
   if ( l_count_8 < Orders && l_count_8 != 0) {
      l_ord_open_price_12 = NormalizeDouble( l_ord_open_price_12 - StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_BUYLIMIT, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 2, 0, Navy);
   }
   return (1);
}

int CheckBS_min() {
   double l_ord_open_price_12;
   double ld_20 = Ask;
   int l_count_8 = 0;
   int l_ord_total_0 = OrdersTotal();
   for (int l_pos_4 = 0; l_pos_4 < l_ord_total_0; l_pos_4++) {
      if (OrderSelect( l_pos_4, SELECT_BY_POS, MODE_TRADES) == TRUE) {
         if (OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_BUYSTOP && OrderMagicNumber() == 1) {
            if (OrderOpenPrice() - Ask < ld_20 && OrderOpenPrice() - Ask > 0.0) {
               ld_20 = OrderOpenPrice() - Ask;
               l_ord_open_price_12 = OrderOpenPrice();
               l_count_8++;
            }
         }
      }
   }
   if ( l_count_8 == 0) {
      l_ord_open_price_12 = NormalizeDouble(Ask + StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_BUYSTOP, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 1, 0, Navy);
   }
   if ( l_ord_open_price_12 - Ask >= 2.0 * StepLevel * Point && l_count_8 != 0) {
      l_ord_open_price_12 = NormalizeDouble( l_ord_open_price_12 - StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_BUYSTOP, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 1, 0, Navy);
   }
   return (1);
}

int CheckBL_min() {
   double l_ord_open_price_12;
   double ld_20 = Ask;
   int l_count_8 = 0;
   int l_ord_total_0 = OrdersTotal();
   for (int l_pos_4 = 0; l_pos_4 < l_ord_total_0; l_pos_4++) {
      if (OrderSelect( l_pos_4, SELECT_BY_POS, MODE_TRADES) == TRUE) {
         if (OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_BUYLIMIT && OrderMagicNumber() == 2) {
            if (Ask - OrderOpenPrice() < ld_20 && Ask - OrderOpenPrice() >= 0.0) {
               ld_20 = Ask - OrderOpenPrice();
               l_ord_open_price_12 = OrderOpenPrice();
               l_count_8++;
            }
         }
      
 
}
   }
   if ( l_count_8 == 0) {
      l_ord_open_price_12 = NormalizeDouble(Ask - StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_BUYLIMIT, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 2, 0, Navy);
   }
   if (Ask - l_ord_open_price_12 >= 2.0 * StepLevel * Point - 2.0 * (Ask - Bid) && l_count_8 != 0) {
      l_ord_open_price_12 = NormalizeDouble( l_ord_open_price_12 + StepLevel * Point, Digits);
      OrderSend(Symbol(), OP_BUYLIMIT, Lots, l_ord_open_price_12, 3, l_ord_open_price_12 - StopLoss * Point - 2.0 * gd_104, l_ord_open_price_12 + Profit * Point + gd_104, "", 2, 0, Navy);
   }
   return (1);
}

int init() {
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   gd_104 = 0;
   CheckBS();
   CheckBL();
   CheckBS_min();
   CheckBL_min();
   return (0);
}

Dossiers :
yolka_1.mq4  6 kb
 
Vinin писал(а) >>

Regardez ça. On dirait que ça marche bien.

J'ai corrigé une erreur.

Dossiers :
 
Vinin >>:

Ошибочку одну исправил

Merci Victor, je resterai en contact si nécessaire.

Gintaras

Vilnius.

 
Vinin >>:

Ошибочку одну исправил

Victor, quand vous aurez le temps, faites-en autant pour l'autre voiture.

Sincèrement.

 
dadi писал(а) >>

Victor, quand vous aurez le temps, faites-en autant pour l'autre voiture.

Respectueusement.

Je vais essayer, mais c'est pour ça.

 
Vinin >>:

Попробую, только вот зачем

Lorsque vous devez vous orienter, les peintures à sens unique vous épargneront bien des tracas inutiles.

Dossiers :
 
Je vois que pour une raison quelconque, des lettres inutiles ont été ajoutées aux noms...
 
dadi писал(а) >>

Je travaille à la main, je mets celle-ci sur le dessus et elle donne une bonne entrée et une bonne sortie sans être " croisée ". Quand on doit s'orienter rapidement, les couleurs à sens unique évitent les tracas inutiles.

Alors peut-être que les points ne sont pas nécessaires du tout.

 
dadi писал(а) >>

Si vous voulez travailler à la main, mettez-le sur le dessus et obtenez une bonne entrée et sortie sans "sur la croix".

Dossiers :