Toute question de débutant, afin de ne pas encombrer le forum. Professionnels, ne passez pas à côté. Nulle part sans toi - 6. - page 1153

 
kalmyk87:

Bonjour, je n'arrive pas à autoriser mql5 dans metatrader4 pour souscrire à des signaux... que faire ?


Écrivez une demande à servicedesk (dans le profil à gauche), avec des détails et des captures d'écran.

 

Les hiboux doivent labourer sur plusieurs paires et de préférence deux hiboux par tableau d'achat séparément des selves.

Tel qu'il est, il s'ouvre à l'infini


int _OrdersTotal=OrdersTotal() ;

for (int i=_OrdersTotal-1 ; i>=0 ; i--) {

si (OrderSelect(i,SELECT_BY_POS)) {

si (OrderMagicNumber() == Magic) {

si (OrderSymbol() == Symbol()) {

si (OrderType() == OP_BUY) {

}}}}}

if(MaPrevious>MaPrevious1)

{

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point ,Ask+TakeProfit*Point, "macd sample",Magic,0,Green) ;

si(ticket>0)

{

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))

Print("Ordre BUY ouvert : ",OrderOpenPrice()) ;

}

sinon

Print("Erreur lors de l'ouverture de l'ordre BUY : ",GetLastError()) ;

retour ;

}

 

aide qui peut

 

Bonjour à tous !

Je sais qu'il est possible d'implémenter une sortie de signal dans l'indicateur :

a). lorsqu'il apparaît sur la barre actuelle sans attendre sa fermeture. Dans ce cas, après la clôture de la barre, le signal peut être annulé ;

b). après la clôture de la barre sur laquelle le signal apparaît.

Je suis intéressé par la variante a). Comment implémenter l'alerte dans un indicateur, sans attendre la fermeture de la barre ?

J'ai essayé de l'implémenter comme un choix de paramètres à la ligne 39 du code de l'indicateur, mais cela n'a pas fonctionné. Comment le faire correctement ?


extern int shift = 0 ; // sur quelle barre le signal est considéré : 0 - sur la barre actuelle ; 1 - sur la barre fermée


Je vous serais très reconnaissant de m'aider !

Dossiers :
 
Tornado:

Bonjour à tous !

Je sais qu'il est possible d'implémenter une sortie de signal dans l'indicateur :

a). lorsqu'il apparaît sur la barre actuelle sans attendre sa fermeture. Dans ce cas, après la clôture de la barre, le signal peut être annulé ;

b). après la clôture de la barre sur laquelle le signal apparaît.

Je suis intéressé par la variante a). Comment implémenter l'alerte dans un indicateur, sans attendre la fermeture de la barre ?

J'ai essayé de l'implémenter comme un choix de paramètres à la ligne 39 du code de l'indicateur, mais cela n'a pas fonctionné. Comment le faire correctement ?


extern int shift = 0 ; // sur quelle barre le signal est considéré : 0 - sur la barre actuelle ; 1 - sur la barre fermée


Je vous serais très reconnaissant de votre aide !


Je l'ai obtenu approximativement comme ceci

//+---------------------------------------------------------------------------------+
//+ MA2_Signal                                                                      +
//+ Индикатор сигналов при пересечении 2-х средних                                  +
//+                                                                                 +
//+ Внешние параметры:                                                              +
//+  ExtPeriodFastMA - период быстой средней                                        +
//+  ExtPeriodSlowMA - период медленной средней                                     +
//+  ExtModeFastMA   - режим быстой средней                                         +
//+  ExtModeSlowMA   - режим медленной средней                                      +
//+   Режимы: 0 = SMA, 1 = EMA, 2 = SMMA (сглаженная), 3 = LWMA (взвешенная)        +
//+  ExtPriceFastMA  - цена быстрой средней                                          +
//+  ExtPriceSlowMA  - цена медленной средней                                       +
//+   Цены: 0 = Close, 1 = Open, 2 = High, 3 = Low, 4 = HL/2, 5 = HLC/3, 6 = HLCC/4 +
//+---------------------------------------------------------------------------------+
#property copyright "Copyright © 2015, Karakurt (mod. GromoZeka 2017)"
#property link      ""

//---- Определение индикаторов
#property indicator_chart_window
#property indicator_buffers 4
//---- Цвета
#property  indicator_color1 Red // 5
#property  indicator_color2 Green        // 7
#property  indicator_color3 DeepSkyBlue
#property  indicator_color4 Magenta
#property  indicator_width1 2
#property  indicator_width2 2
#property  indicator_width3 2
#property  indicator_width4 2


//---- Параметры
extern int    ExtPeriodFastMA = 8;
extern int    ExtPeriodSlowMA = 20;
extern int    ExtModeFastMA   = 1; // 0 = SMA, 1 = EMA, 2 = SMMA, 3 = LWMA
extern int    ExtModeSlowMA   = 1; // 0 = SMA, 1 = EMA, 2 = SMMA, 3 = LWMA
extern int    ExtPriceFastMA  = 0; // 0 = Close, 1 = Open, 2 = High, 3 = Low, 4 = HL/2, 5 = HLC/3, 6 = HLCC/4
extern int    ExtPriceSlowMA  = 0; // 0 = Close, 1 = Open, 2 = High, 3 = Low, 4 = HL/2, 5 = HLC/3, 6 = HLCC/4
extern int shift=0;      // На каком баре считать сигнал: 0 - на текущем; 1 - на закрытом
extern bool   EnableAlert=true;
extern bool   EnableSendNotification=false;
extern bool   EnableSendMail  =  false;
extern bool   EnableSound     = false;
extern string ExtSoundFileNameUp = "Покупаем.wav";
extern string ExtSoundFileNameDn = "Продаем.wav";

//---- Буферы
double FastMA[];
double SlowMA[];
double CrossUp[];
double CrossDown[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- Установка параметров прорисовки
//     Средние
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
//     Сигналы
   SetIndexStyle(2,DRAW_ARROW,EMPTY);
   SetIndexArrow(2,233);
   SetIndexStyle(3,DRAW_ARROW,EMPTY);
   SetIndexArrow(3,234);

//---- Задание буферов
   SetIndexBuffer(0,FastMA);
   SetIndexBuffer(1,SlowMA);
   SetIndexBuffer(2,CrossUp);
   SetIndexBuffer(3,CrossDown);

   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));

//---- Название и метки
   IndicatorShortName("MA2_SignalV2("+ExtPeriodFastMA+","+ExtPeriodSlowMA);
   SetIndexLabel(0,"MA("+ExtPeriodFastMA+","+ExtPeriodSlowMA+")"+ExtPeriodFastMA);
   SetIndexLabel(1,"MA("+ExtPeriodFastMA+","+ExtPeriodSlowMA+")"+ExtPeriodSlowMA);
   SetIndexLabel(2,"Buy");
   SetIndexLabel(3,"Sell");

   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double AvgRange;
   int    iLimit;
   int    i;
   int    counted_bars=IndicatorCounted();

//---- check for possible errors
   if(counted_bars<0)
      return ( -1 );

//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   iLimit=Bars-counted_bars;

   for(i=iLimit; i>=0; i--)
     {
      FastMA[i] = iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i );
      SlowMA[i] = iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i );
      AvgRange=(iMA(NULL,0,10,0,MODE_SMA,PRICE_HIGH,i)-iMA(NULL,0,10,0,MODE_SMA,PRICE_LOW,i))*0.1;
      CrossDown[i+1]=EMPTY_VALUE;
      CrossUp[i+1]=EMPTY_VALUE;

      if((FastMA[i+1]>=SlowMA[i+1]) && (FastMA[i+2]<=SlowMA[i+2]) && (FastMA[i]>SlowMA[i])) // пересечение вверх
        {//
         CrossUp[i+1]=SlowMA[i+1]-Range*0.75;
        }

      if((FastMA[i+1]<=SlowMA[i+1]) && (FastMA[i+2]>=SlowMA[i+2]) && (FastMA[i]<SlowMA[i])) // пересечение вниз
        {//
         CrossDown[i+1]=SlowMA[i+1]+Range*0.75;
        }
     }
   static datetime TimeAlert=0;
   if(TimeAlert!=Time[0])
     {
      TimeAlert=Time[0];
      if(CrossUp[shift]!=EMPTY_VALUE)
        {
         if(EnableAlert) Alert("MA 8-20 ",Symbol()," ",Period(),"M - BUY "); // звуковой сигнал
         if(EnableSound) PlaySound(ExtSoundFileNameUp);
         if(EnableSendNotification) SendNotification("MA 8-20 EUR_H1 - BUY"); // push-уведомление
         if(EnableSendMail) SendMail("MA 8-20: ",Symbol()+" , "+Period()+" мин.-  BUY!"); // email-уведомление
        }
      if(CrossDown[shift]!=EMPTY_VALUE)
        {
         if(EnableAlert) Alert("MA 8-20 ",Symbol()," ",Period(),"M - SELL "); // звуковой сигнал
         if(EnableSound) PlaySound(ExtSoundFileNameDn);
         if(EnableSendNotification) SendNotification("MA 8-20 EUR_H1 - SELL"); // push-уведомление
         if(EnableSendMail) SendMail("MA 8-20: ",Symbol()+" , "+Period()+" мин.- SELL!"); // email-уведомление
        }
     }
   return (0);
  }
//+------------------------------------------------------------------+

J'ai supprimé certaines choses inutiles. J'ai simplifié certaines choses

 
Victor Nikolaev:

C'est plus ou moins ce que j'ai obtenu.

J'ai enlevé des choses inutiles. J'ai simplifié certaines choses.


Merci beaucoup ! Je vais essayer.

 
Victor Nikolaev:

C'est plus ou moins ce que j'ai obtenu.

J'ai enlevé des choses inutiles. J'ai simplifié certaines choses.


C'est malheureux, mais ça ne marche pas. Je l'ai essayé sur l'échelle de temps M5 pour le vérifier plus rapidement. Le signal n'est apparu que lorsque la barre a été fermée et non lorsque les moyennes ont été croisées sur la barre actuelle. Essai sur les grands cadres.

 
//+------------------------------------------------------------------+
class A
  {
public: int       propA;
public:
                     A(void) {propA = 15;};
                    ~A(void) {};
  };
//+------------------------------------------------------------------+
class B: public A
  {
public:
                     B(void){};
                    ~B(void){};
  };
//+------------------------------------------------------------------+
void OnStart()
  {
   B newObj;
   GetA(newObj);
//---
   //B newObjArray[3];
   //GetA_Array(newObjArray);
  }
//+------------------------------------------------------------------+
void GetA(A &obj)
  {
   Print(obj.propA);
  }
//+------------------------------------------------------------------+
void GetA_Array(A &obj[])
  {
   for(int i=0;i<ArraySize(obj);i++)
      Print(obj[i].propA);
  }
//+------------------------------------------------------------------+

Si nous décommentons les lignes restantes dans OnStart(), nous obtenons "newObjArray - parameter conversion not allowed".

Deux questions : pourquoi, et comment y remédier ?

 
Tornado:

C'est malheureux, mais ça ne marche pas. Je l'ai essayé sur l'échelle de temps M5 pour vérifier plus rapidement. Le signal n'est apparu qu'après la fermeture de la barre et non pas lorsque les moyennes ont été croisées sur la barre actuelle. Je l'ai testé sur de grandes échelles de temps.


On dirait qu'on ne se comprend pas.

 

Bonjour les amis.

Comment faire pour que les valeurs de stop loss, tekprofit et trailing soient affichées en pourcentage au lieu de pips.

Cette formule est trop encombrée et ne fonctionne pas du tout.

StopLoss=NormalizeDouble(Bid-(Bid-TrailingStop)/100*TRAL_PERCENT,Digits) ;

Je voudrais avoir la forme la plus simple de pourcentage.

Double Stoploss = 0.05 ;

--------

Profit=Enchère-Perte en pourcentages (c'est un exemple désordonné, mais juste pour la clarté).

Merci.