Je rédigerai un conseiller gratuitement - page 127

 
Наджибулло Хабибов:
Bonjour, j'ai un EA qui ouvre une transaction dans toutes les devises sauf l'or, pouvez-vous m'aider à trouver le code que je dois ajouter dans l'EA pour ouvrir l'or ?

Ne pas être modéré sur le marché ?

 
Наджибулло Хабибов:

lot 0.01 lot pas de stop loss pas de profit dans le log ne s'ouvre pas même s'il n'y a pas d'erreur

Dans la fenêtre des symboles, il y a les caractéristiques techniques de chaque symbole, le volume minimal/maximal, le niveau minimal des stops.

S'il n'y a pas d'erreur, il se peut que l'algorithme ne permette pas d'ouvrir :)

 
VVT:

Dans la fenêtre des symboles, on trouve les caractéristiques techniques de chaque instrument : volume minimum/maximum, niveau de stop minimum.

S'il n'y a pas d'erreur, peut-être que l'algorithme ne permet pas d'ouvrir :)

//--- ***

Si vous connaissez l'algorithme, veuillez vérifier la raison pour laquelle il ne s'ouvre pas pour l'or ?

 
Наджибулло Хабибов:
//--- ***

Si vous savez quelle est la raison de la non-ouverture pour l'or, pouvez-vous s'il vous plaît vérifier ?

Insérez le code correctement : utilisez le bouton Code ou alternativement : joignez le fichier en utilisant le bouton Joindre le fichier

 
Vladimir Karputov:

Insérez le code correctement : utilisez le bouton ou alternativement : attachez le fichier en utilisant le bouton

Oui, montrez ce qui participe à l'ouverture, l'écart, le glissement ou autre chose de faux.

 
//--- Inputs
extern double Lots       = 0.1;      // лот
extern double KLot       = 1;        // умножение лота
extern double MaxLot     = 5;        // максимальный лот
extern double Profit     = 0;        // Профит в валюте
extern int StopLoss      = 0;        // Стоп Лось
extern int TakeProfit    = 0;        // ТейкПрофит
extern int BULevel       = 0;        // уровень БУ
extern int BUPoint       = 30;       // пункты БУ
extern int TrailingStop  = 0;        // трал
extern int StartHour     = 0;        // час начала торговли
extern int StartMin      = 30;       // минута начала торговли
extern int EndHour       = 23;       // час окончания торговли
extern int EndMin        = 30;       // минута окончания торговли
extern int Reverse       = 0;        // 1-реверс
extern int CloseSig      = 0;        // 1-закрытие по сигналу
extern int Slip          = 30;       // реквот
extern int Shift         = 1;        // на каком баре сигнал индикатора
extern int Magic         = 123;      // магик

extern string IndName    = "Aroow";
extern int SignalPeriod  = 9;

datetime t=0;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Comment("");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool TimeSession(int aStartHour,int aStartMinute,int aStopHour,int aStopMinute,datetime aTimeCur)
  {
//--- время начала сессии
   int StartTime=3600*aStartHour+60*aStartMinute;
//--- время окончания сессии
   int StopTime=3600*aStopHour+60*aStopMinute;
//--- текущее время в секундах от начала дня
   aTimeCur=aTimeCur%86400;
   if(StopTime<StartTime)
     {
      //--- переход через полночь
      if(aTimeCur>=StartTime || aTimeCur<StopTime)
        {
         return(true);
        }
     }
   else
     {
      //--- внутри одного дня
      if(aTimeCur>=StartTime && aTimeCur<StopTime)
        {
         return(true);
        }
     }
   return(false);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
  {
   int r=0;
   color clr=Green;
   double sl=0,tp=0;

   if(type==1 || type==3 || type==5)
     {
      clr=Red;
      if(StopLoss>0)
         sl=NormalizeDouble(price+StopLoss*_Point,_Digits);
      if(TakeProfit>0)
         tp=NormalizeDouble(price-TakeProfit*_Point,_Digits);
     }

   if(type==0 || type==2 || type==4)
     {
      clr=Blue;
      if(StopLoss>0)
         sl=NormalizeDouble(price-StopLoss*_Point,_Digits);
      if(TakeProfit>0)
         tp=NormalizeDouble(price+TakeProfit*_Point,_Digits);
     }

   r=OrderSend(NULL,type,Lot(),NormalizeDouble(price,_Digits),Slip,sl,tp,"",Magic,0,clr);
   return;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades()
  {
   int count=0;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()<2)
               count++;
           }
        }
     }
   return(count);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot()
  {
   double lot=Lots;
   
   if(CountTrades()>0)
     {
      lot=NormalizeDouble(lot*MathPow(KLot,CountTrades()),2);
     }
   if(lot>MaxLot)
      lot=Lots;
   return(lot);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void Trailing()
  {
   bool mod;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(Bid-OrderOpenPrice()>TrailingStop*_Point)
                 {
                  if(OrderStopLoss()<Bid-TrailingStop*_Point)
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*_Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }

            if(OrderType()==OP_SELL)
              {
               if((OrderOpenPrice()-Ask)>TrailingStop*_Point)
                 {
                  if((OrderStopLoss()>(Ask+TrailingStop*_Point)) || (OrderStopLoss()==0))
                    {
                     mod=OrderModify(OrderTicket(),OrderOpenPrice(),Ask+TrailingStop*_Point,OrderTakeProfit(),0,Yellow);
                     return;
                    }
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void BU()
  {
   bool m;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==OP_BUY)
              {
               if(OrderOpenPrice()<=(Bid-(BULevel+BUPoint)*_Point) && OrderOpenPrice()>OrderStopLoss())
                 {
                  m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+BUPoint*_Point,OrderTakeProfit(),0,Yellow);
                  return;
                 }
              }

            if(OrderType()==OP_SELL)
              {
               if(OrderOpenPrice()>=(Ask+(BULevel+BUPoint)*_Point) && (OrderOpenPrice()<OrderStopLoss() || OrderStopLoss()==0))
                 {
                  m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-BUPoint*_Point,OrderTakeProfit(),0,Yellow);
                  return;
                 }
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CloseAll(int ot=-1)
  {
   bool cl;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==0 && (ot==0 || ot==-1))
              {
               RefreshRates();
               cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,_Digits),Slip,White);
              }
            if(OrderType()==1 && (ot==1 || ot==-1))
              {
               RefreshRates();
               cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,_Digits),Slip,White);
              }
           }
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double AllProfit(int ot=-1)
  {
   double pr=0;
   for(int i=OrdersTotal()-1; i>=0; i--)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           {
            if(OrderType()==0 && (ot==0 || ot==-1))
              {
               pr+=OrderProfit()+OrderCommission()+OrderSwap();
              }

            if(OrderType()==1 && (ot==1 || ot==-1))
              {
               pr+=OrderProfit()+OrderCommission()+OrderSwap();
              }
           }
        }
     }
   return(pr);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double blu = iCustom(NULL,0,IndName,SignalPeriod,4,Shift);
   double red = iCustom(NULL,0,IndName,SignalPeriod,5,Shift);
   double blu2 = iCustom(NULL,0,IndName,SignalPeriod,4,Shift+1);
   double red2 = iCustom(NULL,0,IndName,SignalPeriod,5,Shift+1);

   bool buy = blu<1000 && red2<1000;
   bool sell = red<1000 && blu2<1000;

   if(Reverse>0)
     {
      buy = red<1000 && blu2<1000;
      sell = blu<1000 && red2<1000;
     }

   if(BULevel>0)
      BU();
   if(TrailingStop>0)
      Trailing();
   if(AllProfit()>Profit && Profit>0)
      CloseAll();

   if(TimeSession(StartHour,StartMin,EndHour,EndMin,TimeCurrent()) && t!=Time[0])
     {
      if(buy)
        {
         PutOrder(0,Ask);
        }
      if(sell)
        {
         PutOrder(1,Bid);
        }
      t=Time[0];
     }

   if(CountTrades()>0 && CloseSig>0)
     {
      if(sell)
        {
         CloseAll(0);
        }
      if(buy)
        {
         CloseAll(1);
        }
     }

   Comment("\n blu: ",blu,
           "\n red: ",red,
           "\n All Profit: ",AllProfit());
  }
//+------------------------------------------------------------------+
VVT:

Oui, montrez-moi ce qui participe à l'ouverture, l'écart, le glissement ou tout ce qui ne va pas.

 

Bonjour à tous !

Il y a 4 indicateurs et une bibliothèque.

Deux indicateurs sont juste nécessaires pour les calculs, 2 sont jetés sur le graphique.

Je veux automatiser ce processus, seulement 3 conditions.... mais je dois tout mettre dans un seul fichier et je ne sais pas quoi faire avec la bibliothèque.

Quelqu'un peut-il le faire ?

 
Наджибулло Хабибов:

Qu'est-ce que cela signifie ? Est-ce un spread et un slippage ? Si oui, fixez une valeur supérieure à 100-150 par exemple.

extern int BUPoint       = 30;       // пункты БУ
extern int Slip          = 30;       // реквот
 
VVT:

Qu'est-ce que cela signifie ? Est-ce un spread et un slippage ? Si oui, fixez une valeur plus élevée, par exemple 100-150.

oui, définissez ces valeurs en fonction des caractéristiques techniques de l'instrument, c'est-à-dire le spread maximum de l'instrument

 
VVT:

si oui, réglez ces valeurs en fonction des caractéristiques techniques de l'instrument, c'est-à-dire que le spread maximum de l'instrument n'est pas o

ne fonctionne pas set 150 ne s'ouvre pas

Raison: