MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 1372

 
DanilaMactep :

좋은 오후에요 여러분.

노력하다

 //--ТРАЛ ПО ПАРАбОЛИКУ
void Tral_parabolik()
{ // НАЧАЛО ТРАЛ ПО ПАРАБОЛИК
//+------------------------------------------------------------------+
   int     Tral = tral;
   double Sar  = iCustom ( _Symbol ,PeriodForWork_tral_parabolik, "Parabolic" ,step_tral_parabolik,max_tral_parabolik, 1 );
//+------------------------------------------------------------------+
   for ( int pos= 0 ;pos< OrdersTotal ();pos++)
     {
       if ( OrderSelect (pos,SELECT_BY_POS,MODE_TRADES))
       if (OrderSymbol()== _Symbol )
        {
         if (OrderType()==OP_SELL)
           {
             if (OrderOpenPrice()>Ask+Tral* Point &&OrderOpenPrice()>Sar)
              {
               if (OrderStopLoss()!= Sar&&Sar>Ask)
                 {
                   if (OrderModify(OrderTicket(),OrderOpenPrice(), NormalizeDouble (Sar, Digits ),OrderTakeProfit(), 0 , clrBlack ))
                    {
                     Print ( "Order SELL Modify" , GetLastError ());
                    }
                 }
              }
           }
         if (OrderType()==OP_BUY)
           {
             if (OrderOpenPrice()<Bid-Tral* Point &&OrderOpenPrice()<Sar)
              {
               if (OrderStopLoss()!= Sar&&Sar<Bid)
                 {
                   if (OrderModify(OrderTicket(),OrderOpenPrice(), NormalizeDouble (Sar, Digits ),OrderTakeProfit(), 0 , clrGreen ))
                    {
                     Print ( "Order BUY Modify" , GetLastError ());
                    }
                 }
              }
           }
        }
     }
   if ( GetLastError ()== 141 ){ Alert ( GetLastError ()); ExpertRemove ();} // ПРОВЕРКА ОТ ДОЛБАНИЯ СЕРВЕРА И БАНА СЧЁТА
} // КОНЕЦ ТРАЛ ПО ПАРАБОЛИК     
 
Сергей Дыбленко :
도움을 주신 모든 분들께 감사드립니다. 하지만 제 두뇌는 제가 필요한 일을 하기에 충분하지 않습니다!

이런 뜻이야? 여기서만 위치가 빨간색이면 로트가 증가합니다. 이해합니다. 위치가 검은색일 때 증가해야 합니다 ???

스냅 사진

.................................................................................. . ........................................................................... ........................................................... ... ...........................................................

 //+------------------------------------------------------------------+
//|                                               Moving Average.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright    "2005-2014, MetaQuotes Software Corp."
#property link          "http://www.mql4.com"
#property description "Moving Average sample expert advisor"

#define MAGICMA   20131111
//--- Inputs
input string    t0= "------------ Exchange TP SL --------" ; //
input double    InpTProfit       = 10 ;             // Exchange TP
input double    InpStopLoss      = 1000000 ;       // Exchange SL
input string    t1= "------------ Lots Parameters -------" ; //
input double    InpLots1         = 0.01 ;           // : Lots 1
input int       InpLots_01       = 2 ;             // Exchange Lots
input double    InpLots2         = 0.03 ;           // : Lots 2
input int       InpLots_02       = 4 ;             // Exchange Lots
input double    InpLots3         = 0.06 ;           // : Lots 3
input int       InpLots_03       = 8 ;             // Exchange Lots
input double    InpLots4         = 0.12 ;           // : Lots 4
input string    t2= "------------ Moving Parameters -----" ; //
input int       MovingPeriod     = 12 ;             // MovingPeriod
input int       MovingShift      = 6 ;             // MovingShift
//+------------------------------------------------------------------+
//| Calculate open positions                                         |
//+------------------------------------------------------------------+
int CalculateCurrentOrders( string symbol)
  {
   int buys= 0 ,sells= 0 ;
//---
   for ( int i= 0 ; i< OrdersTotal (); i++)
     {
       if ( OrderSelect (i,SELECT_BY_POS,MODE_TRADES))
         continue ;
       if (OrderSymbol()== Symbol () && OrderMagicNumber()==MAGICMA)
        {
         if (OrderType()==OP_BUY)
            buys++;
         if (OrderType()==OP_SELL)
            sells++;
        }
     }
//--- return orders volume
   if (buys> 0 )
       return (buys);
   else
       return (-sells);
  }
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double OptimizedBuy( void )
  {
   double PROFIT_BUY= 0.00 ;
   for ( int i= OrdersTotal ()- 1 ; i>= 0 ; i--) // returns the number of open positions
     {
       if ( OrderSelect (i,SELECT_BY_POS) && OrderSymbol()== Symbol ())
        {
         if (OrderSymbol()== Symbol () && OrderType()==OP_BUY)
           {
            PROFIT_BUY=PROFIT_BUY+ NormalizeDouble (OrderProfit(), 2 );
           }
        }
     }
   double Lots=InpLots1;
   double ab=PROFIT_BUY;
   if (ab<- 1 && ab>=-InpLots_01)
      Lots=InpLots1;
   if (ab<-InpLots_01 && ab>=-InpLots_02)
      Lots=InpLots2;
   if (ab<-InpLots_02 && ab>=-InpLots_03)
      Lots=InpLots3;
   if (ab<-InpLots_03)
      Lots=InpLots4;
//--- return trading volume
   return (Lots);
  }
//+------------------------------------------------------------------+
//| Calculate optimal lot size                                       |
//+------------------------------------------------------------------+
double OptimizedSell( void )
  {
   double PROFIT_SELL= 0.00 ;
   for ( int i= OrdersTotal ()- 1 ; i>= 0 ; i--) // returns the number of open positions
     {
       if ( OrderSelect (i,SELECT_BY_POS) && OrderSymbol()== Symbol ())
        {
         if (OrderSymbol()== Symbol () && OrderType()==OP_SELL)
           {
            PROFIT_SELL=PROFIT_SELL+ NormalizeDouble (OrderProfit(), 2 );
           }
        }
     }
   double Lots=InpLots1;
   double ab=PROFIT_SELL;
   if (ab<- 1 && ab>=-InpLots_01)
      Lots=InpLots1;
   if (ab<-InpLots_01 && ab>=-InpLots_02)
      Lots=InpLots2;
   if (ab<-InpLots_02 && ab>=-InpLots_03)
      Lots=InpLots3;
   if (ab<-InpLots_03)
      Lots=InpLots4;
//--- return trading volume
   return (Lots);
  }
//+------------------------------------------------------------------+
//| Check for long position closing                                  |
//+------------------------------------------------------------------+
bool ProfitOnTick( void )
  {
   bool res= false ;
   double PROFIT_BUY= 0.00 ;
   double PROFIT_SELL= 0.00 ;
   for ( int i= OrdersTotal ()- 1 ; i>= 0 ; i--) // returns the number of open positions
     {
       if ( OrderSelect (i,SELECT_BY_POS) && OrderSymbol()== Symbol ())
        {
         if (OrderSymbol()== Symbol () && OrderType()==OP_BUY)
           {
            PROFIT_BUY=PROFIT_BUY+ NormalizeDouble (OrderProfit(), 2 );
           }
         if (OrderSymbol()== Symbol () && OrderType()==OP_SELL)
           {
            PROFIT_SELL=PROFIT_SELL+ NormalizeDouble (OrderProfit(), 2 );
           }
        }
     }
   int Close_ticketb= 0 ;
   int totalb= OrdersTotal ();
   int b = 0 ;
   for (b = totalb; b >= 0 ; b--)
     {
       if ( OrderSelect (b,SELECT_BY_POS) && OrderSymbol()== Symbol ())
        {
         //OrderSelect(i,SELECT_BY_POS);
         if (OrderSymbol()== Symbol () && OrderType()==OP_BUY)
           {
             if (PROFIT_BUY<-InpStopLoss || PROFIT_BUY>=InpTProfit)
              {
               Close_ticketb = OrderClose(OrderTicket(),OrderLots(),MarketInfo( Symbol (),MODE_BID), 5 );
               PlaySound ( "ok.wav" );
              }
           }
        }
      res= true ;
     }
   int Close_tickets= 0 ;
   int totals= OrdersTotal ();
   int s = 0 ;
   for (s = totals; s >= 0 ; s--)
     {
       if ( OrderSelect (s,SELECT_BY_POS) && OrderSymbol()== Symbol ())
        {
         if (OrderSymbol()== Symbol () && OrderType()==OP_SELL)
           {
             if (PROFIT_SELL<-InpStopLoss || PROFIT_SELL>=InpTProfit)
              {
               Close_tickets = OrderClose(OrderTicket(),OrderLots(),MarketInfo( Symbol (),MODE_ASK), 5 );
               PlaySound ( "ok.wav" );
              }
           }
        }
      res= true ;
     }
//--- result
   return (res);
  }
//+------------------------------------------------------------------+
//| Check for open order conditions                                  |
//+------------------------------------------------------------------+
void CheckForOpen()
  {
   double ma;
   int     res;
//--- go trading only for first tiks of new bar
   if (Volume[ 0 ]> 1 )
       return ;
//--- get Moving Average
   ma= iMA ( NULL , 0 ,MovingPeriod,MovingShift, MODE_SMA , PRICE_CLOSE , 0 );
//--- sell conditions
   if (Open[ 1 ]>ma && Close[ 1 ]<ma)
     {
      res= OrderSend ( Symbol (),OP_SELL,OptimizedSell(),Bid, 3 , 0 , 0 , "" ,MAGICMA, 0 ,Red);
       return ;
     }
//--- buy conditions
   if (Open[ 1 ]<ma && Close[ 1 ]>ma)
     {
      res= OrderSend ( Symbol (),OP_BUY,OptimizedBuy(),Ask, 3 , 0 , 0 , "" ,MAGICMA, 0 ,Blue);
       return ;
     }
//---
  }
//+------------------------------------------------------------------+
//| OnTick function                                                  |
//+------------------------------------------------------------------+
void OnTick ()
  {
//--- check for history and trading
   if ( Bars < 100 || IsTradeAllowed()== false )
       return ;
//--- calculate open orders by current symbol
   if (CalculateCurrentOrders( Symbol ())== 0 )
      CheckForOpen();
   ProfitOnTick();
//---
  }
//+------------------------------------------------------------------+
 
SanAlex :

이런 뜻이야? 여기서만 위치가 빨간색이면 로트가 증가합니다. 이해합니다. 위치가 검은색일 때 증가해야 합니다 ???

.................................................................................. . ........................................................................... ........................................................... ... ...........................................................

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\

모든 이익 - 이 두 가지 기능에 따라 다릅니다. 그것들을 올바르게 설정하고 일반 전문가에게 밀어 넣으면됩니다.

 input string    t0= "------------ Exchange TP SL --------" ; //
input double    InpTProfit       = 10 ;             // Exchange TP
input double    InpStopLoss      = 1000000 ;       // Exchange SL
input string    t1= "------------ Lots Parameters -------" ; //
input double    InpLots1         = 0.01 ;           // : Lots 1
input int       InpLots_01       = 2 ;             // Exchange Lots
input double    InpLots2         = 0.03 ;           // : Lots 2
input int       InpLots_02       = 4 ;             // Exchange Lots
input double    InpLots3         = 0.06 ;           // : Lots 3
input int       InpLots_03       = 8 ;             // Exchange Lots
input double    InpLots4         = 0.12 ;           // : Lots 4

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

이것은 위의 전문가가 제공한 것입니다. 이는 단지 예일 뿐입니다.

스냅샷 2

 
SanAlex :

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\

모든 이익 - 이 두 가지 기능에 따라 다릅니다. 그것들을 올바르게 설정하고 일반 전문가에게 밀어 넣으면됩니다.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

이것은 위의 전문가가 제공한 것입니다. 이는 단지 예일 뿐입니다.


Sasha를 보십시오. 그렇지 않으면 GRAIL 을 구축할 것입니다)
 
MakarFX :
Sasha를 보세요. 그렇지 않으면 GRAIL을 구축할 것입니다)

Grail 을 하나로 만드는 것은 지루합니다. 함께하면 더 재미있습니다!!!

 

도움이 필요하다! 가장 가까운 0이 아닌 값을 찾기 위해 iCustom에 대한 배열을 만드는 방법은 무엇입니까? MT4

 

상인 여러분!

iLowest (예: x 막대의 경우 가장 작은 값)와 iAD의 표시 값(자연적으로 백분율 데이터가 아니라 일부 점에서 실제 데이터를 생성하는 볼륨 샤프트)을 교차하는 방법, 각각 가장 작은 것이 필요합니다. iAD에 따른 x 막대의 값. 덕분에. MT4

Документация по MQL5: Доступ к таймсериям и индикаторам / iLowest
Документация по MQL5: Доступ к таймсериям и индикаторам / iLowest
  • www.mql5.com
iLowest - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Порт-моне тв :

상인 여러분!

iLowest (예: x 막대의 경우 가장 작은 값)와 iAD의 표시 값(자연적으로 백분율 데이터가 아니라 일부 점에서 실제 데이터를 생성하는 볼륨 샤프트)을 교차하는 방법, 각각 가장 작은 것이 필요합니다. iAD에 따른 x 막대의 값. 덕분에. MT4

도움이 되는 글

기사와 MakarFX 도 볼 수 있습니다.

그의 질문에 대한 답이 있습니다.

Работа по Накоплению/Распределению и что из этого можно сделать
Работа по Накоплению/Распределению и что из этого можно сделать
  • www.mql5.com
Индикатор Накопления/Распределения A/D имеет одно интересное свойство - пробитие трендовой линии, построенной на графике данного индикатора с определённой долей вероятности говорит нам о скором пробое линии тренда на графике цены. Данная статья будет полезна и интересна людям, только начинающим программировать на MQL4, поэтому я постарался изложить всё в наиболее доступной для понимания форме и использовать самые простые конструкции построения кода.
 
Alekseu Fedotov :

도움이 되는 글

기사와 MakarFX 도 볼 수 있습니다.

그의 질문에 대한 답이 있습니다.

감사해요
 
안녕하세요. 롤오버 롤오버가 여전히 관련이 있는지 말씀해 주세요. 마지막이 언제였는지 기억이 안 나네요.