어드바이저를 무작위로 모으는 방법 - 페이지 53

 
Alexsandr San :

#속성 버전 "1.012"

기능이 약간 향상됨

트리거되면 수평 매도 라인이 포지션을 열고 수평 매수 라인을 배치하고 그 반대의 경우도 마찬가지입니다.

또한 라인은 " 0 " 으로 또는 그 사이에서 설정되고 거리는 Obj: Trailing Step MACD 에 의해 설정됩니다.

또는 수평선 "LOW" 에서

OnTimer 에서 "LOW Up" "LOW Down" 은 동일하며 거리만 설정됩니다( 입력 짧은 InpObjTrailingStepCS = 5 ; // Obj: 후행 단계, 핍(1.00045-1.00055=1 핍)

표시기에서 수평선 의 거리 를 찾는 방법 트롤에 설정하기 위한 Low_Macd_Line.mq5 (각 쌍에서 다른 거리)

유틸리티 설정에서 복사하여 붙여넣기

그림 에서 " 0 "에서 Horizontal BUY 0.0064까지 그리고 Horizontal LOW에 닿으면 Horizontal SELL을 설정합니다(아래만 " 0 " - 0.0064)

중요한!!! 유틸리티에 입력하는 숫자 앞에 빼기(-)를 넣는 것은 불가능합니다.

옵션 중 하나인 이 기능은

손익 함수 #속성 버전 "1.013" 변경

 input string    t= "-----  Parameters         -----" ;               //
input string    Template                     = "ADX" ;             // Имя шаблона(without '.tpl')
input bool      Inpwithout                   = false ;             // Сменить только шаблон (true)
input datetime InpMonday_2                  = D'1970.01.01' ;     // Dell (00::00 -> off)
input double    TargetTakeProfit             = 1000000 ;           // Прибыль
input double    TargetStopLoss               = 1000000 ;           // Убыток
input uint      maxLimits                    = 1 ;                 // Кол-во Позиции Открыть в одну сторону
input double    InpLots                      = 0.01 ;               // Lots
input int       InpTakeProfit                = 900 ;               // Take Profit ("0"-No. 5<100)

도달하면 모든 것이 닫히고 삭제되며 열려 있는 모든 창을 지정된 템플릿으로 변경합니다.

파일:
 

이 기능은 손익에서 포지션을 엽니다.

 //+------------------------------------------------------------------+
//|                                            Close_Open_Profit.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"

#define InpMagic 0
//---
#include <Trade\PositionInfo.mqh>
#include <Trade\Trade.mqh>
#include <Trade\SymbolInfo.mqh>
CPositionInfo  m_position; // trade position object
CTrade         m_trade;     // trading object
CSymbolInfo    m_symbol;   // symbol info object
//---
input double InpLots                      = 0.01 ;   // Lots
input double TargetTakeProfit             = 10000 ; // Прибыль
input double TargetStopLoss               = 10000 ; // Убыток
input bool    Acc                          = false ; // Open=true; CloseAll=false;
input string t10= "- Buy=false><Sell=true  -----" ;   //
input bool    ObjRevers                    = false ; // BUY=false; SELL=true;
//---
double m_adjusted_point; // point value adjusted for 3 or 5 points
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
   if (!m_symbol.Name( Symbol ())) // sets symbol name
       return ( INIT_FAILED );;
//---
   m_trade.SetExpertMagicNumber(InpMagic);
   m_trade.SetMarginMode();
   m_trade.SetTypeFillingBySymbol(m_symbol.Name());
//--- 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_trade.SetDeviationInPoints( 3 *digits_adjust);
//---
   ObjectCreate ( 0 , "Buy" , OBJ_BUTTON , 0 , 0 , 0 );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_XDISTANCE , ChartGetInteger ( 0 , CHART_WIDTH_IN_PIXELS )- 102 );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_YDISTANCE , 37 );
   ObjectSetString ( 0 , "Buy" , OBJPROP_TEXT , "Buy" );
   ObjectSetInteger ( 0 , "Buy" , OBJPROP_BGCOLOR , clrMediumSeaGreen );
//---
   ObjectCreate ( 0 , "Sell" , OBJ_BUTTON , 0 , 0 , 0 );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_XDISTANCE , ChartGetInteger ( 0 , CHART_WIDTH_IN_PIXELS )- 50 );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_YDISTANCE , 37 );
   ObjectSetString ( 0 , "Sell" , OBJPROP_TEXT , "Sell" );
   ObjectSetInteger ( 0 , "Sell" , OBJPROP_BGCOLOR , clrDarkOrange );
//---
   ObjectCreate ( 0 , "CloseAll" , OBJ_BUTTON , 0 , 0 , 0 );
   ObjectSetInteger ( 0 , "CloseAll" , OBJPROP_XDISTANCE , ChartGetInteger ( 0 , CHART_WIDTH_IN_PIXELS )- 75 );
   ObjectSetInteger ( 0 , "CloseAll" , OBJPROP_YDISTANCE , 57 );
   ObjectSetString ( 0 , "CloseAll" , OBJPROP_TEXT , "CloseAll" );
   ObjectSetInteger ( 0 , "CloseAll" , OBJPROP_BGCOLOR , clrMediumVioletRed );
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
   if ( ObjectFind ( 0 , "Buy" )== 0 )
     {
       ObjectDelete ( 0 , "Buy" );
     }
   if ( ObjectFind ( 0 , "Sell" )== 0 )
     {
       ObjectDelete ( 0 , "Sell" );
     }
   if ( ObjectFind ( 0 , "CloseAll" )== 0 )
     {
       ObjectDelete ( 0 , "CloseAll" );
     }
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick ()
  {
   if ( AccountInfoDouble ( ACCOUNT_PROFIT )<-TargetStopLoss ||
       AccountInfoDouble ( ACCOUNT_PROFIT )>=TargetTakeProfit)
     {
       if (!Acc)
        {
         CloseAll();
        }
       if (Acc)
        {
         if (!ObjRevers)
           {
            CloseAll();
             double price=m_symbol.Ask();
            m_trade.PositionOpen(m_symbol.Name(), ORDER_TYPE_BUY ,InpLots,price, 0.0 , 0.0 );
           }
         if (ObjRevers)
           {
            CloseAll();
             double price=m_symbol.Bid();
            m_trade.PositionOpen(m_symbol.Name(), ORDER_TYPE_SELL ,InpLots,price, 0.0 , 0.0 );
           }
        }
       PlaySound ( "ok.wav" );
     }
   if ( ObjectGetInteger ( 0 , "Buy" , OBJPROP_STATE )!= 0 )
     {
       ObjectSetInteger ( 0 , "Buy" , OBJPROP_STATE , 0 );
       double price=m_symbol.Ask();
      m_trade.PositionOpen(m_symbol.Name(), ORDER_TYPE_BUY ,InpLots,price, 0.0 , 0.0 );
     }
   if ( ObjectGetInteger ( 0 , "Sell" , OBJPROP_STATE )!= 0 )
     {
       ObjectSetInteger ( 0 , "Sell" , OBJPROP_STATE , 0 );
       double price=m_symbol.Bid();
      m_trade.PositionOpen(m_symbol.Name(), ORDER_TYPE_SELL ,InpLots,price, 0.0 , 0.0 );
     }
   if ( ObjectGetInteger ( 0 , "CloseAll" , OBJPROP_STATE )!= 0 )
     {
       ObjectSetInteger ( 0 , "CloseAll" , OBJPROP_STATE , 0 );
      CloseAll();
     }
  }
//+------------------------------------------------------------------+
//| start function                                                   |
//+------------------------------------------------------------------+
void CloseAll( void )
  {
   for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) // returns the number of current positions
       if (m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
        {
         ClosePosition(m_position. Symbol ()); // close a position by the specified symbo
        }
  }
//+------------------------------------------------------------------+
//| Close selected position                                          |
//+------------------------------------------------------------------+
void ClosePosition( const string symbol)
  {
   if (InitTrade(symbol))
      m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbo
   PlaySound ( "ok.wav" );
  }
//+------------------------------------------------------------------+
//| Init trade object                                                |
//+------------------------------------------------------------------+
bool InitTrade( const string symbol)
  {
   if (!m_symbol.Name(symbol)) // sets symbol name
       return ( false );
   if (IsFillingTypeAllowed(symbol, SYMBOL_FILLING_FOK ))
      m_trade.SetTypeFilling( ORDER_FILLING_FOK );
   else
       if (IsFillingTypeAllowed(symbol, SYMBOL_FILLING_IOC ))
         m_trade.SetTypeFilling( ORDER_FILLING_IOC );
       else
         m_trade.SetTypeFilling( ORDER_FILLING_RETURN );
   return ( true );
  }
//+------------------------------------------------------------------+
//| Checks if the specified filling mode is allowed                  |
//+------------------------------------------------------------------+
bool IsFillingTypeAllowed( string symbol, int fill_type)
  {
//--- Obtain the value of the property that describes allowed filling modes
   int filling=( int ) SymbolInfoInteger (symbol, SYMBOL_FILLING_MODE );
//--- Return true, if mode fill_type is allowed
   return ((filling & fill_type)==fill_type);
  }
//+------------------------------------------------------------------+
파일:
 
Alexsandr San :

유틸리티 Command.mq5보조 표시기가 추가되면 라인이 이동하고 해당 라인에서 명령을 설정할 수 있습니다. SEM 으로 블라인드 처리  


검색에서 https://www.mql5.com/ru/code/16269 를 찾았습니다. 이것은 MT4가 포함된 스크립트입니다. 감사합니다 Author Alexey Volchanskiy Health! 그리고 최고!

PriceLines
PriceLines
  • www.mql5.com
Стандартная сетка графика имеет ряд особенностей, не позволяющих с одного взгляда определить движение цены котировки: шаг сетки динамически меняется при переключении таймфрейма, шаг не привязан к базовым уровням, например к 1.12000, как на скриншоте ниже. Скрипт Price Lines размечает уровни цен на графике и служит дополнением к...
 
Alexsandr San :

검색에서 https://www.mql5.com/ru/code/16269 를 찾았습니다. 이것은 MT4가 포함된 스크립트입니다. 감사합니다 Author Alexey Volchanskiy Health! 그리고 최고!

MT4용 뿐만 아니라 MT5용 스크립트도 있습니다 https://www.mql5.com/ru/code/16262 마스터의 인디케이터에 만들었습니다 작가님 Alexey Volchanskiy Health 감사합니다 ! 그리고 최고!

GBPUSDH4

PriceLines
PriceLines
  • www.mql5.com
Стандартная сетка графика имеет ряд особенностей, не позволяющих с одного взгляда определить движение цены котировки: шаг сетки динамически меняется при переключении таймфрейма, шаг не привязан к базовым уровням, например к 1.12000, как на скриншоте ниже. Скрипт Price Lines размечает уровни цен на графике и служит дополнением к сетке графика...
파일:
PriceLines.mq5  11 kb
 
Alexsandr San :

손익 함수 #속성 버전 "1.013" 변경

도달하면 모든 것이 닫히고 삭제되며 열려 있는 모든 창을 지정된 템플릿으로 변경합니다.

#속성 버전 "1.014"

그래도 한 명의 Expert Advisor가 여러 쌍에 대해 작업할 때 저울의 이익은 필요한 기능입니다.

이 쌍에서 마감되고 다른 쌍에 영향을 미치지 않도록 손익을 재작업했습니다.

 //+------------------------------------------------------------------+
input string    t= "-----  Parameters         -----" ;               //
input string    Template                     = "ADX" ;             // Имя шаблона(without '.tpl')
input bool      Inpwithout                   = false ;             // Сменить только шаблон (true)
input datetime InpMonday_2                  = D'1970.01.01' ;     // Dell (00::00 -> off)
input double    TargetProfit                 = 999999.99 ;         // Цель Баланса(Ваш Баланс + сумма)
input uint      maxLimits                    = 1 ;                 // Кол-во Позиции Открыть в одну сторону
input double    InpLots                      = 0.01 ;               // Lots
input int       InpTakeProfit                = 900 ;               // Take Profit ("0"-No. 5<100)
input double    TargetTakeProfit             = 1000000 ;           // Прибыль на паре в валюте
input double    TargetStopLoss               = 1000000 ;           // Убыток на паре в валюте

손익, 금액은 설정 1000000에서 기록됩니다(예: 통화의 1단위) - 귀하의 통화 가 백만 달러가 될 때까지 위치 닫힙니다.

파일:
 
Alexsandr San :

#속성 버전 "1.014"

그래도 한 명의 Expert Advisor가 여러 쌍에 대해 작업할 때 저울의 이익은 필요한 기능입니다.

이 쌍에서 마감되고 다른 쌍에 영향을 미치지 않도록 손익을 재작업했습니다.

손익, 금액은 설정 1000000에서 기록됩니다(예: 통화의 1단위) - 귀하의 통화 가 백만 달러가 될 때까지 위치 닫힙니다.

#속성 버전 "1.015"

이 기능을 약간 수정했습니다( 손익) - 결국, 한 쌍에서 한 방향으로 여러 위치를 열 수 있습니다. 이제 총 금액으로 닫히고 한 위치는 플러스에, 다른 하나는 마이너스에 있을 수 있지만 총 금액은 설정에서 지정된 금액과 같습니다.

----------------------

여기 기능이 있습니다 ( 손익)

 //+------------------------------------------------------------------+
//| Check for long position closing                                  |
//+------------------------------------------------------------------+
bool ProfitOnTick( void )
  {
   bool res= false ;
   double level;
   double PROFIT_BUY= 0.00 ;
   double PROFIT_SELL= 0.00 ;
   for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) // returns the number of current positions
       if (m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if (m_position. Symbol ()==m_symbol.Name())
           {
             if (m_position.PositionType()== POSITION_TYPE_BUY )
              {
               PROFIT_BUY=PROFIT_BUY+ PositionGetDouble ( POSITION_PROFIT );
               if (PROFIT_BUY<-TargetStopLoss || PROFIT_BUY>=TargetTakeProfit) // if the profit
                   if (FreezeStopsLevels(level))
                     ClosePositions( POSITION_TYPE_BUY ,level);
              }
             else
               if (m_position.PositionType()== POSITION_TYPE_SELL )
                 {
                  PROFIT_SELL=PROFIT_SELL+ PositionGetDouble ( POSITION_PROFIT );
                   if (PROFIT_SELL<-TargetStopLoss || PROFIT_SELL>=TargetTakeProfit) // if the profit
                     if (FreezeStopsLevels(level))
                        ClosePositions( POSITION_TYPE_SELL ,level);
                 }
            res= true ;
           }
//--- result
   return (res);
  }
//+------------------------------------------------------------------+
파일:
 
Alexsandr San :

#속성 버전 "1.015"

이 기능을 약간 수정했습니다( 손익) - 결국 한 쌍에서 한 방향으로 여러 위치를 열 수 있습니다 - 이제 총 금액으로 마감되고 한 위치는 플러스에 다른 위치는 마이너스에 있을 수 있지만 총 금액은 설정에서 지정된 금액과 같습니다.

----------------------

여기 기능이 있습니다 ( 손익)

지금 실제 계정에서 테스트했습니다 - 두 개의 열린 위치 에서 작은 이익을 원했고 설정에 160을 입력했습니다. 가장 큰 음수 위치에서 닫힐 것이라고 생각했지만 감염이 없었습니다. 닫았습니다.

그의 이익은 160이 되었고 두 포지션을 모두 청산했고 나는 머그입니다. 음수를 추가하여 첫 번째 열린 위치에서 계산해야한다는 것이 밝혀졌습니다.

스냅 사진

스냅샷2

 
Alexsandr San :

#속성 버전 "1.015"

이 기능을 약간 수정했습니다( 손익) - 결국, 한 쌍에서 한 방향으로 여러 위치를 열 수 있습니다. 이제 총 금액으로 닫히고 한 위치는 플러스에, 다른 하나는 마이너스에 있을 수 있지만 총 금액은 설정에서 지정된 금액과 같습니다.

----------------------

여기 기능이 있습니다 ( 손익)

#속성 버전 "1.016"

찌르다 - 모든 사람에게 시도했지만 그래야만 합니다. 내가 즉시 금액을 설정하고 많은 위치를 열면 정확히 그 금액이 마감됩니다.

여기에 기능이 있습니다. 약간 다릅니다.

 //+------------------------------------------------------------------+
//| Check for long position closing                                  |
//+------------------------------------------------------------------+
bool ProfitOnTick( void )
  {
   bool res= false ;
   double level;
   double PROFIT_BUY= 0.00 ;
   double PROFIT_SELL= 0.00 ;
   for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) // returns the number of current positions
       if (m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if (m_position. Symbol ()==m_symbol.Name())
           {
             if (m_position.PositionType()== POSITION_TYPE_BUY )
              {
               PROFIT_BUY=PROFIT_BUY+m_position.Commission()+m_position.Swap()+m_position.Profit();
               if (PROFIT_BUY<-TargetStopLoss || PROFIT_BUY>=TargetTakeProfit) // if the profit
                   if (FreezeStopsLevels(level))
                     ClosePositions( POSITION_TYPE_BUY ,level);
              }
             else
               if (m_position.PositionType()== POSITION_TYPE_SELL )
                 {
                  PROFIT_SELL=PROFIT_SELL+m_position.Commission()+m_position.Swap()+m_position.Profit();
                   if (PROFIT_SELL<-TargetStopLoss || PROFIT_SELL>=TargetTakeProfit) // if the profit
                     if (FreezeStopsLevels(level))
                        ClosePositions( POSITION_TYPE_SELL ,level);
                 }
            res= true ;
           }
//--- result
   return (res);
  }
//+------------------------------------------------------------------+
파일:
 
Alexsandr San :

#속성 버전 "1.016"

찌르다 - 모든 사람에게 시도했지만 그래야만 합니다. 내가 즉시 금액을 설정하고 많은 위치를 열면 정확히 그 금액이 마감됩니다.

여기에 기능이 있습니다. 약간 다릅니다.

테스터에서 이 기능을 확인했습니다. 이익 300, 손실 10000을 설정했습니다. 시작은 EURUSD H1 쌍의 지표( LeMan_BrainTrend1Sig )에서 잔고 100 레버리지 100, 많은 0.01

스냅샷.PNG

스냅샷2

기능 통화의 이익 손실 - BUY 및 SELL은 동일한 쌍에서 이익 을 얻습니다.

 
Alexsandr San :

테스터에서 이 기능을 확인했습니다. 이익 300, 손실 10000을 설정했습니다. 시작은 EURUSD H1 쌍의 지표( LeMan_BrainTrend1Sig )에서 잔고 100 레버리지 100, 많은 0.01

기능 통화의 이익 손실 - BUY 및 SELL은 동일한 쌍에서 이익 을 얻습니다.

기능이 하나 더 추가되었습니다. 터미널에서 실시간으로 체크인만 하면 됩니다.

 input    int      limit_total_symbol           = 3 ;                 // Кол-во Позиции при Убытке
input double    TargetOpenLot                = 1000000 ;           // Убыток на Позиции Открыть Позицию

이 버전은 그렇습니다 - In Tester Play

 //+------------------------------------------------------------------+
//| Check for long position closing                                  |
//+------------------------------------------------------------------+
bool OpenLotBuy( void )
  {
   bool res= false ;
   double PROFIT_BUY= 0.00 ;
   CloseTikB= iClose ( NULL , Period (), 0 );
   OpenTikB= iOpen ( NULL , Period (), 0 );
//---
   int total= PositionsTotal (); // количество открытых позиций
   for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) // returns the number of current positions
       if (m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if (m_position. Symbol ()==m_symbol.Name())
           {
             if (total> 0 )
              {
               ulong position_ticket= PositionGetTicket (total- 1 ); // тикет позиции
              }
             if (total<limit_total_symbol) // количество открытых позиций
              {
               if (OpenTikB<CloseTikB)
                 {
                   if (m_position.PositionType()== POSITION_TYPE_BUY )
                    {
                     PROFIT_BUY=PROFIT_BUY+m_position.Commission()+m_position.Swap()+m_position.Profit();
                     if (PROFIT_BUY<-TargetOpenLot)
                        ExtNeedOpenBuy= true ;
                     if (LongObjOpened())
                         return (res);
                    }
                  res= true ;
                 }
              }
           }
//--- result
   return (res);
  }
//+------------------------------------------------------------------+
//| Check for long position closing                                  |
//+------------------------------------------------------------------+
bool OpenLotSell( void )
  {
   bool res= false ;
   double PROFIT_SELL= 0.00 ;
   CloseTikS= iClose ( NULL , Period (), 0 );
   OpenTikS= iOpen ( NULL , Period (), 0 );
//---
   int total= PositionsTotal (); // количество открытых позиций
   for ( int i= PositionsTotal ()- 1 ; i>= 0 ; i--) // returns the number of current positions
       if (m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
         if (m_position. Symbol ()==m_symbol.Name())
           {
             if (total> 0 )
              {
               ulong position_ticket= PositionGetTicket (total- 1 ); // тикет позиции
              }
             if (total<limit_total_symbol) // количество открытых позиций
              {
               if (OpenTikS>CloseTikS)
                 {
                   if (m_position.PositionType()== POSITION_TYPE_SELL )
                    {
                     PROFIT_SELL=PROFIT_SELL+m_position.Commission()+m_position.Swap()+m_position.Profit();
                     if (PROFIT_SELL<-TargetOpenLot)
                        ExtNeedOpenSell= true ;
                     if (ShortObjOpened())
                         return (res);
                    }
                  res= true ;
                 }
              }
           }
//--- result
   return (res);
  }
//+------------------------------------------------------------------+

스냅 사진

스냅샷2

파일: