Rédiger un conseiller efficace - page 27

 
darirunu1 #:

Imaginez le conseiller qui

Je vous ai dit il y a un an qu'il gagnait encore, si je puis dire, 50% par an.

sur les tiques que vous pouvez

faire la même chose pendant des mois et ne pas s'en faire.

Détendez-vous, soyez confiant et ayez un effet tangible.

;)

 
darirunu1 #:

C'est moi))

norme

 
Renat Akhtyamov #:

norP

Pourquoi ça ? Quelque chose semble toujours surgir sur le forum et puis les gens arrivent et le prennent dans une direction différente ?

 
Renat Akhtyamov #:

vous pouvez le faire sur les tiques.

Faites la même chose pendant des mois et ne vous inquiétez pas.

calmement, avec confiance, et de manière tangible.

;)

Je n'y ai pas encore pensé, mon conseiller expert est suspendu pendant un an pour vérifier sa précocité. La livre sterling a résisté à toutes les tendances. C'est comme s'il savait quand commencer à négocier. Le tirage au sort a été de 1,47 %.

 
darirunu1 #:

Je n'y ai pas encore pensé, il est suspendu depuis un an pour vérifier son caractère loustique. Sur la livre, il a résisté à toutes les tendances. C'est comme s'il savait à l'avance quand commencer à négocier. Le tirage au sort a été de 1,47 %.

Augmentez le lot de 10 fois - le bénéfice augmente de 10 fois.

 
a007 #:

Augmentez le lot de 10 fois - le bénéfice augmente de 10 fois.

Wababai, quel garçon malin et intelligent)) Peut-être y a-t-il d'autres options ?

 

Rédiger un conseiller efficace - A suivre.

Alors, par où commencer ?

1. Quel est le meilleur effet de levier pour un EA ? - je pense que pas plus de 100

2. Je pense que la fonction la plus importante pour un EA est un lot. C'est la fonction dont nous tirons nos bénéfices.

3. ----

4. ----

etc. ----

de quelles autres fonctions l'EE a-t-elle besoin pour être efficace ?

 
SanAlex # :

Rédaction d'un conseiller efficace - A suivre.

et alors par où commencer ?

1. quel effet de levier est le meilleur pour un conseiller. - je pense pas plus de 100

2. Une fonction importante pour un conseiller - si je comprends bien, le lot. De cette fonction, nous recevons également des bénéfices.

3. ----

4. ----

etc. ----

Quelles autres fonctions sont nécessaires pour qu'un Expert Advisor soit efficace ?

Je vais commencer alors - si cela ne vous dérange pas -

ajout d'une augmentation du lot à la position suivante (jaune où j'ai creusé et changé)

 //+------------------------------------------------------------------+
//|                                                  MACD Sample.mq5 |
//|                   Copyright 2009-2017, MetaQuotes Software Corp. |
//|                                               http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright    "Copyright 2009-2017, MetaQuotes Software Corp."
#property link          " http://www.mql5.com "
#property version      "5.50"
#property description "It is important to make sure that the expert works with a normal"
#property description "chart and the user did not make any mistakes setting input"
#property description "variables (Lots, TakeProfit, TrailingStop) in our case,"
#property description "we check TakeProfit on a chart of more than 2*trend_period bars"

#define MACD_MAGIC 1234502
//---
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
#include <Trade\PositionInfo.mqh>
#include <Trade\AccountInfo.mqh>
//+------------------------------------------------------------------+
//| ENUM_LOT_RISK                                                    |
//+------------------------------------------------------------------+
enum LotMax
  {
   Lot= 0 ,   // Lots
   Lotx2= 1 , // Lots*2
  };
//---
input LotMax InpLotRisk       =Lotx2; // Lots,- Lots*2
input double InpLots          = 0.01 ;   // Lots
input int     InpMACDOpenLevel = 3 ;     // MACD open level (in pips)
input int     InpMACDCloseLevel= 2 ;     // MACD close level (in pips)
input int     InpMATrendPeriod = 26 ;     // MA trend period
//---
int ExtTimeOut= 10 ; // time out in seconds between trade operations
//+------------------------------------------------------------------+
//| MACD Sample expert class                                         |
//+------------------------------------------------------------------+
class CSampleExpert
  {
protected :
   double             m_adjusted_point;             // point value adjusted for 3 or 5 points
   CTrade            m_trade;                       // trading object
   CSymbolInfo       m_symbol;                     // symbol info object
   CPositionInfo     m_position;                   // trade position object
   CAccountInfo      m_account;                     // account info wrapper
   //--- indicators
   int                m_handle_macd;                 // MACD indicator handle
   int                m_handle_ema;                 // moving average indicator handle
   //--- indicator buffers
   double             m_buff_MACD_main[];           // MACD indicator main buffer
   double             m_buff_MACD_signal[];         // MACD indicator signal buffer
   double             m_buff_EMA[];                 // EMA indicator buffer
   //--- indicator data for processing
   double             m_macd_current;
   double             m_macd_previous;
   double             m_signal_current;
   double             m_signal_previous;
   double             m_ema_current;
   double             m_ema_previous;
   //---
   double             m_macd_open_level;
   double             m_macd_close_level;
   datetime           ExtPrevBars;                 // "0" -> D'1970.01.01 00:00';

public :
                     CSampleExpert( void );
                    ~CSampleExpert( void );
   bool               Init( void );
   void               Deinit( void );
   bool               Processing( void );
   double             OptimizedBuy( void );
   double             OptimizedSell( void );

protected :
   bool               InitIndicators( void );
   bool               LongOpened( void );
   bool               ShortOpened( void );
  };
//--- global expert
CSampleExpert ExtExpert;
//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
CSampleExpert::CSampleExpert( void ) : m_adjusted_point( 0 ),
   m_handle_macd( INVALID_HANDLE ),
   m_handle_ema( INVALID_HANDLE ),
   m_macd_current( 0 ),
   m_macd_previous( 0 ),
   m_signal_current( 0 ),
   m_signal_previous( 0 ),
   m_ema_current( 0 ),
   m_ema_previous( 0 ),
   m_macd_open_level( 0 ),
   m_macd_close_level( 0 ),
   ExtPrevBars( 0 )
  {
   ArraySetAsSeries (m_buff_MACD_main, true );
   ArraySetAsSeries (m_buff_MACD_signal, true );
   ArraySetAsSeries (m_buff_EMA, true );
  }
//+------------------------------------------------------------------+
//| Destructor                                                       |
//+------------------------------------------------------------------+
CSampleExpert::~CSampleExpert( void )
  {
  }
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double CSampleExpert::OptimizedBuy( void )
  {
   double PROFIT_BUY= 0.00 ;
   for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) // returns the number of open positions
     {
       string    position_GetSymbol= PositionGetSymbol (i); // GetSymbol позиции
       if (position_GetSymbol==m_symbol.Name())
        {
         if (m_position.PositionType()== POSITION_TYPE_BUY )
           {
            PROFIT_BUY=PROFIT_BUY+m_position.Select( Symbol ());
           }
        }
     }
   double Lots=InpLots;
   double ab=PROFIT_BUY;
   switch (InpLotRisk)
     {
       case Lot:
         Lots=InpLots;
         break ;
       case Lotx2:
         if (ab> 0 && ab<= 1 )
            Lots=InpLots* 2 ;
         if (ab> 1 && ab<= 2 )
            Lots=InpLots* 4 ;
         if (ab> 2 && ab<= 3 )
            Lots=InpLots* 8 ;
         if (ab> 3 )
            Lots=InpLots* 16 ;
         break ;
     }
   return (Lots);
  }
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double CSampleExpert::OptimizedSell( void )
  {
   double PROFIT_SELL= 0.00 ;
   for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) // returns the number of open positions
     {
       string    position_GetSymbol= PositionGetSymbol (i); // GetSymbol позиции
       if (position_GetSymbol==m_symbol.Name())
        {
         if (m_position.PositionType()== POSITION_TYPE_SELL )
           {
            PROFIT_SELL=PROFIT_SELL+m_position.Select( Symbol ());
           }
        }
     }
   double Lots=InpLots;
   double ab=PROFIT_SELL;
   switch (InpLotRisk)
     {
       case Lot:
         Lots=InpLots;
         break ;
       case Lotx2:
         if (ab> 0 && ab<= 1 )
            Lots=InpLots* 2 ;
         if (ab> 1 && ab<= 2 )
            Lots=InpLots* 4 ;
         if (ab> 2 && ab<= 3 )
            Lots=InpLots* 8 ;
         if (ab> 3 )
            Lots=InpLots* 16 ;
         break ;
     }
   return (Lots);
  }
//+------------------------------------------------------------------+
//| Initialization and checking for input parameters                 |
//+------------------------------------------------------------------+
bool CSampleExpert::Init( void )
  {
//--- initialize common information
   m_symbol.Name( Symbol ());                   // symbol
   m_trade.SetExpertMagicNumber(MACD_MAGIC); // magic
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol( Symbol ());
//--- tuning for 3 or 5 digits
   int digits_adjust= 1 ;
   if (m_symbol. Digits ()== 3 || m_symbol. Digits ()== 5 )
      digits_adjust= 10 ;
   m_adjusted_point=m_symbol. Point ()*digits_adjust;
//--- set default deviation for trading in adjusted points
   m_macd_open_level =InpMACDOpenLevel*m_adjusted_point;
   m_macd_close_level=InpMACDCloseLevel*m_adjusted_point;
//--- set default deviation for trading in adjusted points
   m_trade.SetDeviationInPoints( 3 *digits_adjust);
//---
   if (!InitIndicators())
       return ( false );
//--- succeed
   return ( true );
  }
//+------------------------------------------------------------------+
//| Initialization of the indicators                                 |
//+------------------------------------------------------------------+
bool CSampleExpert::InitIndicators( void )
  {
//--- create MACD indicator
   if (m_handle_macd== INVALID_HANDLE )
       if ((m_handle_macd= iMACD ( NULL , 0 , 12 , 26 , 9 , PRICE_CLOSE ))== INVALID_HANDLE )
        {
         printf ( "Error creating MACD indicator" );
         return ( false );
        }
//--- create EMA indicator and add it to collection
   if (m_handle_ema== INVALID_HANDLE )
       if ((m_handle_ema= iMA ( NULL , 0 ,InpMATrendPeriod, 0 , MODE_EMA , PRICE_CLOSE ))== INVALID_HANDLE )
        {
         printf ( "Error creating EMA indicator" );
         return ( false );
        }
//--- succeed
   return ( true );
  }
//+------------------------------------------------------------------+
//| Check for long position opening                                  |
//+------------------------------------------------------------------+
bool CSampleExpert::LongOpened( void )
  {
   bool res= false ;
//--- check for long position (BUY) possibility
   if (m_macd_current< 0 )
       if (m_macd_current>m_signal_current && m_macd_previous<m_signal_previous)
         if ( MathAbs (m_macd_current)>(m_macd_open_level) && m_ema_current>m_ema_previous)
           {
             double price=m_symbol.Ask();
             //--- check for free money
             if (m_account.FreeMarginCheck( Symbol (), ORDER_TYPE_BUY , OptimizedBuy() ,price)< 0.0 )
               printf ( "We have no money. Free Margin = %f" ,m_account.FreeMargin());
             else
              {
               //--- open position
               if (m_trade.PositionOpen( Symbol (), ORDER_TYPE_BUY , OptimizedBuy() ,price, 0.0 , 0.0 ))
                   printf ( "Position by %s to be opened" , Symbol ());
               else
                 {
                   printf ( "Error opening BUY position by %s : '%s'" , Symbol (),m_trade.ResultComment());
                   printf ( "Open parameters : price=%f" ,price);
                 }
              }
             //--- in any case we must exit from expert
            res= true ;
           }
//--- result
   return (res);
  }
//+------------------------------------------------------------------+
//| Check for short position opening                                 |
//+------------------------------------------------------------------+
bool CSampleExpert::ShortOpened( void )
  {
   bool res= false ;
//--- check for short position (SELL) possibility
   if (m_macd_current> 0 )
       if (m_macd_current<m_signal_current && m_macd_previous>m_signal_previous)
         if (m_macd_current>(m_macd_open_level) && m_ema_current<m_ema_previous)
           {
             double price=m_symbol.Bid();
             //--- check for free money
             if (m_account.FreeMarginCheck( Symbol (), ORDER_TYPE_SELL , OptimizedSell() ,price)< 0.0 )
               printf ( "We have no money. Free Margin = %f" ,m_account.FreeMargin());
             else
              {
               //--- open position
               if (m_trade.PositionOpen( Symbol (), ORDER_TYPE_SELL , OptimizedSell() ,price, 0.0 , 0.0 ))
                   printf ( "Position by %s to be opened" , Symbol ());
               else
                 {
                   printf ( "Error opening SELL position by %s : '%s'" , Symbol (),m_trade.ResultComment());
                   printf ( "Open parameters : price=%f" ,price);
                 }
              }
             //--- in any case we must exit from expert
            res= true ;
           }
//--- result
   return (res);
  }
//+------------------------------------------------------------------+
//| main function returns true if any position processed             |
//+------------------------------------------------------------------+
bool CSampleExpert::Processing( void )
  {
//--- we work only at the time of the birth of new bar
   datetime time_0= iTime (m_symbol.Name(), Period (), 0 );
   if (time_0==ExtPrevBars)
       return ( false );
   ExtPrevBars=time_0;
   if (!m_symbol.RefreshRates())
     {
      ExtPrevBars= 0 ;
       return ( false );
     }
//--- refresh indicators
   if ( BarsCalculated (m_handle_macd)< 2 || BarsCalculated (m_handle_ema)< 2 )
       return ( false );
   if ( CopyBuffer (m_handle_macd, 0 , 0 , 2 ,m_buff_MACD_main)  != 2 ||
       CopyBuffer (m_handle_macd, 1 , 0 , 2 ,m_buff_MACD_signal)!= 2 ||
       CopyBuffer (m_handle_ema, 0 , 0 , 2 ,m_buff_EMA)         != 2 )
     {
      ExtPrevBars= 0 ;
       return ( false );
     }
//   m_indicators.Refresh();
//--- to simplify the coding and speed up access
//--- data are put into internal variables
   m_macd_current   =m_buff_MACD_main[ 0 ];
   m_macd_previous  =m_buff_MACD_main[ 1 ];
   m_signal_current =m_buff_MACD_signal[ 0 ];
   m_signal_previous=m_buff_MACD_signal[ 1 ];
   m_ema_current    =m_buff_EMA[ 0 ];
   m_ema_previous   =m_buff_EMA[ 1 ];
//--- it is important to enter the market correctly,
//--- but it is more important to exit it correctly...
//--- first check if position exists - try to select it
//--- check for long position (BUY) possibility
   if (LongOpened())
       return ( true );
//--- check for short position (SELL) possibility
   if (ShortOpened())
       return ( true );
//--- exit without position processing
   return ( false );
  }
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ( void )
  {
//--- create all necessary objects
   if (!ExtExpert.Init())
       return ( INIT_FAILED );
//--- secceed
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert new tick handling function                                |
//+------------------------------------------------------------------+
void OnTick ( void )
  {
   static datetime limit_time= 0 ; // last trade processing time + timeout
//--- don't process if timeout
   if ( TimeCurrent ()>=limit_time)
     {
       //--- check for data
       if ( Bars ( Symbol (), Period ())> 2 *InpMATrendPeriod)
        {
         //--- change limit time by timeout in seconds if processed
         if (ExtExpert.Processing())
            limit_time= TimeCurrent ()+ExtTimeOut;
        }
     }
  }
//+------------------------------------------------------------------+
Dossiers :
 
Georgiy Merts #:

Tout dépend de l'ordre dans lequel le maximum est défini. Une fractale classique est constituée de cinq barres, celle du milieu étant au-dessus (au-dessous) des autres. Mais, dans cette image, les hauteurs ne sont pas dessinées selon les fractales.

Je vais maintenant prendre le graphique actuel avec les fractales classiques et tracer une ligne. Attendez un peu.

Ici. Le graphique actuel de l'Eurodollar, montre. Si nous marquons les hauts et les bas avec des fractales, il y a deux lignes de tendance dans le graphique, toutes deux ont déjà été franchies ; le moment de leur construction est marqué par des flèches. Au moment de la pénétration, les lignes se rompent. Une troisième ligne descendante sera tracée à travers les fractales de 8 heures et de 18 heures d' hier. Il doit être tiré dès que le prix passe sous le plancher de 15 heures.


Dans cet exemple, les deux lignes de tendance rouge et bleue ont été tracées lorsque le prix est au niveau égal à +/- le niveau de rupture de cette même ligne de tendance. Combien (en pips ou en % de la vague) peut-on gagner avec cela ?

 
SanAlex #:

Je vais commencer alors - si ça ne vous dérange pas -

ajouté beaucoup d'augmentation à la position suivante (en jaune où j'ai creusé et changé)

Ceci sans résultat de fermeture

Capture d'écran 2021-11-21 072405

Ouvrir et multiplier les lots est bien sûr une bonne chose, mais nous devons collecter les bénéfices d'une manière ou d'une autre.

1. nous devons ajouter la fermeture, = par exemple avec l'achat fermé profit - et la vente par exemple les laisser pendre jusqu'à ce qu'un profit vienne.

Raison: