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

 

표시기에는 4개의 수평선이 있습니다. 그 중 2개는 Heiken_Ashi 표시기로 전원이 공급됩니다.

구매 또는 판매를 할 수 있는 2단계. 빨간색을 교차하면 하나의 신호가 트리거 되고 파란색을 교차하면 다른 신호가 트리거됩니다.

EURJPYM1

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

중간(선(빨간색과 파란색) 사이)에 있으면 신호가 작동하지 않습니다. 신호가 어느 방향으로나 나가자 마자 작동합니다.

파일:
LN_2.mq5  22 kb
 
Alexsandr San :

표시기에는 4개의 수평선이 있습니다. 그 중 2개는 Heiken_Ashi 표시기로 전원이 공급됩니다.

2단계에서 구매 또는 판매할 수 있습니다. 빨간색을 교차하면 하나의 신호가 트리거 되고 파란색을 교차하면 다른 신호가 트리거됩니다.

----------

중간(선(빨간색과 파란색) 사이)에 있으면 신호가 작동하지 않습니다. 신호가 어느 방향으로나 나가자 마자 작동합니다.

이 지표에 - 전문가 조정

차트에 표시기를 설치한 다음 동일한 차트에 Expert Advisor를 설치해야 합니다.

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

위치가 열림 - 표시기가 제거됩니다. 잠시 후 Indicator를 다시 설치했습니다 (Expert의 작업을 확인하는 방법)

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

신호가 트리거되면 위치가 열리고 표시기가 라인과 함께 제거됩니다.


파일:
Exp_LN_2.mq5  20 kb
 

수동 거래를 위한 두 명의 전문가 결합

https://www.mql5.com/ru/code/24803

그리고 이것은 https://www.mql5.com/ru/code/26353

AutoClose Line
AutoClose Line
  • www.mql5.com
Помощник закрытия позиции, если цена пересекла линию: Правило закрытия: цена Open и цена Close текущего бара должны оказаться по разные стороны от линии. Имя линии задаётся в параметре "Line name" - эту линию пользователь проводит сам. Тип линии может быть...
파일:
 
Alexsandr San :

수동 거래를 위한 두 명의 전문가 결합

https://www.mql5.com/en/code/24803

그리고 이것은 https://www.mql5.com/en/code/26353

다른 라인 추가됨

 //+------------------------------------------------------------------+
//| Enum Lor or Risk                                                 |
//+------------------------------------------------------------------+
enum ENUM_TRADE_COMMAND
  {
   close_buys= 0 ,     // Close All Buy's
   close_sells= 1 ,     // Close All Sell's
   close_all= 2 ,       // Close All Buy's and Sell's
   open_buy= 3 ,       // Open Buy
   open_sell= 4 ,       // Open Sell
   open_buy_sell= 5 ,   // Open Buy and Sell
  };
//--- input parameters
input uint      maxLimits                    = 1 ;                 // Кол-во Позиции Открыть в одну сторону
input double    InpLots                      = 0.01 ;               // Lots
input ushort    InpSignalsFrequency          = 10 ;                 // Search signals, in seconds (min value "10")
input string    InpNameR                     = "LineR" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandR   = close_all;         // Trade command:
input bool      ObjRevers                    = false ;             // Obj: Revers
input string    InpNameS                     = "LineS" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandS   = close_all;         // Trade command:
input ulong     InpMagic                     = 78712995 ;           // Magic number
//---
파일:
 
Alexsandr San :

다른 라인 추가

본격적인 전문가에게는 충분하지 않습니다.

1 - 손절매, 포인트로 이익 실현(보이지 않음)

2 - 수평선에서 후행 정지

3 - 표시기의 신호

이 Expert Advisor 2_LineOpenClose.mq5 를 수정하겠습니다.  

 //--- input parameters
input uint      maxLimits                    = 1 ;                 // Кол-во Позиции Открыть в одну сторону
input double    InpLots                      = 0.01 ;               // Lots
input ushort    InpSignalsFrequency          = 10 ;                 // Search signals, in seconds (min value "10")
input string    InpNameR                     = "LineR" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandR   = close_all;         // Trade command:
input bool      ObjRevers                    = false ;             // Obj: Revers
input string    InpNameS                     = "LineS" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandS   = close_all;         // Trade command:
input ulong     InpMagic                     = 78712995 ;           // Magic number
//---
 
Alexsandr San :

본격적인 전문가에게는 충분하지 않습니다.

1 - 손절매, 포인트로 이익 실현(보이지 않음)

2 - 수평선에서 후행 정지

3 - 표시기의 신호

이 Expert Advisor 2_LineOpenClose.mq5 를 수정하겠습니다.  

추가됨 - 표시기의 신호

이런 식으로

 //+------------------------------------------------------------------+
//| Get value of buffers                                             |
//+------------------------------------------------------------------+
double iGetArray( const int handle, const int buffer, const int start_pos, const int count, double &arr_buffer[])
  {
   bool result= true ;
   if (! ArrayIsDynamic (arr_buffer))
     {
       Print ( "This a no dynamic array!" );
       return ( false );
     }
   ArrayFree (arr_buffer);
//--- reset error code
   ResetLastError ();
//--- fill a part of the iBands array with values from the indicator buffer
   int copied= CopyBuffer (handle,buffer,start_pos,count,arr_buffer);
   if (copied!=count)
     {
       //--- if the copying fails, tell the error code
       PrintFormat ( "Failed to copy data from the indicator, error code %d" , GetLastError ());
       //--- quit with zero result - it means that the indicator is considered as not calculated
       return ( false );
     }
   return (result);
  }
//+------------------------------------------------------------------+
//| Search trading signals                                           |
//+------------------------------------------------------------------+
bool SearchTradingSignals( 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==ExtPrevBarsY)
       return ( true );
   ExtPrevBarsY=time_0;
   if (!m_symbol.RefreshRates())
     {
      ExtPrevBarsY= 0 ;
       return ( false );
     }
//---
   double BuyBuffer[];
   double SellBuffer[];
   ArraySetAsSeries (BuyBuffer, true );
   ArraySetAsSeries (SellBuffer, true );
   if (!iGetArray(handle_iCustom, 1 , 0 , 2 ,BuyBuffer) || !iGetArray(handle_iCustom, 0 , 0 , 2 ,SellBuffer))
     {
      ExtPrevBarsY= 0 ;
       return ( false );
     }
//---
   if (BuyBuffer[ 1 ]!= 0.0 )
     {
       switch (InpTradeCommandY)
        {
         case   close_buys:
            ExtNeedCloseBuy= true ;
             if (LongObjClosed())
               break ;
         case   close_sells:
            ExtNeedCloseSell= true ;
             if (ShortObjClosed())
               break ;
         case close_all:
            ExtNeedCloseAll= true ;
             if (LongShortObjClosed())
               break ;
         case open_buy:
            ExtNeedOpenBuy= true ;
             if (LongObjOpened())
               break ;
         case open_sell:
            ExtNeedOpenSell= true ;
             if (ShortObjOpened())
               break ;
         default :
            ExtNeedOpenBuySell= true ;
             if (LongShortObjOpened())
               break ;
        }
     }
   if (SellBuffer[ 1 ]!= 0.0 )
     {
       switch (InpTradeCommandU)
        {
         case   close_buys:
            ExtNeedCloseBuy= true ;
             if (LongObjClosed())
               break ;
         case   close_sells:
            ExtNeedCloseSell= true ;
             if (ShortObjClosed())
               break ;
         case close_all:
            ExtNeedCloseAll= true ;
             if (LongShortObjClosed())
               break ;
         case open_buy:
            ExtNeedOpenBuy= true ;
             if (LongObjOpened())
               break ;
         case open_sell:
            ExtNeedOpenSell= true ;
             if (ShortObjOpened())
               break ;
         default :
            ExtNeedOpenBuySell= true ;
             if (LongShortObjOpened())
               break ;
        }
     }
//---
   return ( true );
  }
//+------------------------------------------------------------------+

지금 설정에서

 //--- input parameters
input uint      maxLimits                    = 1 ;                 // Кол-во Позиции Открыть в одну сторону
input double    InpLots                      = 0.01 ;               // Lots
input ushort    InpSignalsFrequency          = 10 ;                 // Search signals, in seconds (min value "10")
input string    InpNameR                     = "LineR" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandR   = open_buy;           // Trade command:
input string    InpNameS                     = "LineS" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandS   = open_sell;         // Trade command:
input string    short_name             = "Examples\\ZigzagColor" ; // Name Indicators
input ENUM_TRADE_COMMAND InpTradeCommandY   = open_buy;           // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU   = open_sell;         // Trade command: (SellBuffer Indicators)
input bool      ObjRevers                    = false ;             // Obj: Revers
//---

표시기의 신호 확인

평가

그래프

파일:
XXX_Ind.mq5  52 kb
 
Alexsandr San :

본격적인 전문가에게는 충분하지 않습니다.

1 - 손절매, 포인트로 이익 실현(보이지 않음)

2 - 수평선에서 후행 정지

3 - 표시기의 신호

이 Expert Advisor 2_LineOpenClose.mq5 를 수정하겠습니다.  

수평선에서 추가 및 후행 정지. 모든 것이 추가 된 것 같으며 성능을 확인하는 것이 남아 있습니다.

설정은 다음과 같습니다.

 //+------------------------------------------------------------------+
input string    t= "-----  Parameters         -----" ;               //
input string    Template                     = "ADX" ;             // Имя шаблона(without '.tpl')
input double    TargetProfit                 = 999999.99 ;         // Цель Баланса(Ваш Баланс + сумма)
input uint      maxLimits                    = 1 ;                 // Кол-во Позиции Открыть в одну сторону
input double    InpLots                      = 0.01 ;               // Lots
input int       InpTakeProfit                = 50 ;                 // Take Profit ("0"-No. 5<100)
input string    t0= "----- Trailing Line      -----" ;               //
input string    InpObjUpName                 = "TOP" ;             // Obj: TOP (Horizontal Line)
input ENUM_TRADE_COMMAND InpTradeCommand    = close_sells;       // Obj:  command:
input string    InpObjDownName               = "LOWER" ;           // Obj: LOWER (Horizontal Line)
input ENUM_TRADE_COMMAND InTradeCommand     = close_buys;         // Obj:  command:
input ushort    InpObjTrailingStop           = 30 ;                 // Obj: Trailing Stop (distance from price to object, in pips)
input ushort    InpObjTrailingStep           = 5 ;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string    t1= "----- Line name: 1       -----" ;               //
input string    InpNameR                     = "LineR" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandR   = open_buy;           // Trade command:
input string    t2= "----- Line name: 2       -----" ;               //
input string    InpNameS                     = "LineS" ;           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandS   = open_sell;         // Trade command:
input string    t3= "----- Indicators:        -----" ;               //
input string    short_name                   = "Examples\\ZigzagColor" ; // Name Indicators
input bool      InpIndicators                = false ;             // Indicators: Start (true)
input ENUM_TRADE_COMMAND InpTradeCommandY   = open_buy;           // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU   = open_sell;         // Trade command: (SellBuffer Indicators)
input string    t4= "----- Revers Buy><Sell   -----" ;               //
input bool      ObjRevers                    = false ;             //  Revers
//---


파일:
 
Alexsandr San :

수평선에서 추가 및 후행 중지. 모든 것이 추가 된 것 같으며 성능을 확인하는 것이 남아 있습니다.

설정은 다음과 같습니다.  

작동 원리는 다음과 같습니다.

자금이 주어진 목표에 도달하면 모든 열린 쌍에서 모든 위치가 닫히고 차트가 모두 "ADX" 패턴으로 변경됩니다.

(중요합니다. 설정에 입력한 잔액보다 숫자가 높아야 합니다.) 그렇지 않으면 전문가가 열려 있는 모든 위치를 닫고 템플릿의 차트를 변경합니다.

 //+------------------------------------------------------------------+
input string    t= "-----  Parameters         -----" ;               //
input string    Template                     = "ADX" ;             // Имя шаблона(without '.tpl')
input double    TargetProfit                 = 999999.99 ;         // Цель Баланса(Ваш Баланс + сумма)

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

로트 매개변수.

하나의 위치로 0.06을 설정하거나 위치의 수를 6 x 0.01로 설정할 수 있습니다.

 input uint      maxLimits                    = 1 ;                 // Кол-во Позиции Открыть в одну сторону
input double    InpLots                      = 0.01 ;               // Lots

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

이익 실현 매개변수.

포인트 수에 따라 작동합니다("0"이 있으면 위치가 닫힙니다). 거리를 지정해야 합니다.

 input int       InpTakeProfit                = 50 ;                 // Take Profit ("0"-No. 5<100)

XXX_후행선.mq5  

 
Alexsandr San :

추가됨 - 표시기의 신호

이런 식으로

지금 설정에서

표시기의 신호 확인

인디케이터에서는 포지션만 오픈, 클로징은 터미널 전문가의 방법을 따랐습니다(이동평균)

많이 조정되지 않은 반전

 //+------------------------------------------------------------------+
//| Check for close position conditions                              |
//+------------------------------------------------------------------+
void CheckForClose( void )
  {
//---
   double BuyBuffer[];
   double SellBuffer[];
   ArraySetAsSeries (BuyBuffer, true );
   ArraySetAsSeries (SellBuffer, true );
   if (!iGetArray(handle_iCustom, 1 , 0 , 2 ,BuyBuffer) || !iGetArray(handle_iCustom, 0 , 0 , 2 ,SellBuffer))
     {
       return ;
     }
//--- positions already selected before
   bool signal= false ;
   long type= PositionGetInteger ( POSITION_TYPE );
   if (ObjRevers)
     {
       if (type==( long ) POSITION_TYPE_BUY && BuyBuffer[ 1 ]!= 0.0 )
         signal= true ;
       if (type==( long ) POSITION_TYPE_SELL && SellBuffer[ 1 ]!= 0.0 )
         signal= true ;
     }
   if (!ObjRevers)
     {
       if (type==( long ) POSITION_TYPE_BUY && SellBuffer[ 1 ]!= 0.0 )
         signal= true ;
       if (type==( long ) POSITION_TYPE_SELL && BuyBuffer[ 1 ]!= 0.0 )
         signal= true ;
     }
//--- additional checking
   if (signal)
     {
       if ( TerminalInfoInteger ( TERMINAL_TRADE_ALLOWED ) && Bars ( _Symbol , _Period )> 100 )
         m_trade.PositionClose( _Symbol , 3 );
     }
//---
  }
//+------------------------------------------------------------------+

스냅 사진

세마포어 표시기를 사용하는 가장 간단한 거래 시스템

2012년 1월 13일, 13:27



일반적인 세마포어, 신호 표시기의 샘플

현재 코드 베이스 에는 그러한 지표가 상당히 많이 있습니다. 이 기사의 맥락에서 저는 소스 리소스에 대한 몇 가지 링크만 만들 것입니다.


파일:
 
Alexsandr San :

인디케이터에서는 포지션만 오픈, 클로징은 터미널 전문가의 방법을 따랐습니다(이동평균)

많이 조정되지 않은 반전

닫히는 것, 그렇지 않습니다. 표시기에서 위치를 닫는 기능을 수정하는 방법을 찾고 있습니다.

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

수정된 것 같습니다 - 동일한 Expert Advisor (이동 평균) 에서 추가됨

 //+------------------------------------------------------------------+
//| Position select depending on netting or hedging                  |
//+------------------------------------------------------------------+
bool SelectPosition()
  {
   bool res= false ;
//--- check position in Hedging mode
   if (ExtHedging)
     {
       uint total= PositionsTotal ();
       for ( uint i= 0 ; i<total; i++)
        {
         string position_symbol= PositionGetSymbol (i);
         if ( _Symbol ==position_symbol && InpMagic== PositionGetInteger ( POSITION_MAGIC ))
           {
            res= true ;
             break ;
           }
        }
     }
//--- check position in Netting mode
   else
     {
       if (! PositionSelect ( _Symbol ))
         return ( false );
       else
         return ( PositionGetInteger ( POSITION_MAGIC )==InpMagic); //---check Magic number
     }
//--- result for Hedging mode
   return (res);
  }
//+------------------------------------------------------------------+

그리고 OnTick()

       if (InpCloseOpposite && InpIndicators)
        {
         //---
         if (SelectPosition())
            CheckForClose();
         else
            SearchTradingSignals();
        }
       if (!InpCloseOpposite && InpIndicators)
        {
         SearchTradingSignals();
        }

이 경우는 SelectPosition() 을 거쳐야 합니다.

파일: