0
Спасибо.
Пожалуйста, напишите это, чтобы торговать на таймфрейме M5.
avatar

Sirojiddin

  • 28 февраля 2023, 21:39
0
Мне важно, как его использовать.
2 -й стрелка…
avatar

Sirojiddin

  • 14 апреля 2022, 19:59
0
Я могу использовать другие индикаторы, вы напишите.
avatar

Sirojiddin

  • 14 апреля 2022, 19:57
0
Спасибо, отличная работа!
avatar

Sirojiddin

  • 20 октября 2021, 07:55
0
Можно ли понизить цифры в Low? Потому что он был внутри свечи.
avatar

Sirojiddin

  • 19 октября 2021, 16:30
0
Здравствуйте!
Да, это так!
Спасибо.
Отличная работа!
avatar

Sirojiddin

  • 19 октября 2021, 16:19
0
Сделайте 96 или более свечей видимыми.
avatar

Sirojiddin

  • 15 октября 2021, 03:36
0
Почему «string symb» пишется дважды?
avatar

Sirojiddin

  • 29 сентября 2021, 09:16
0
void CloseAll(string symb,string symb, int op=-1, int magic=-1)
Здесь есть ошибка?
avatar

Sirojiddin

  • 29 сентября 2021, 09:13
0
Спасибо. Я попробую это.
avatar

Sirojiddin

  • 29 сентября 2021, 09:03
0
//+------------------------------------------------------------------+
//| Закрытие позиции по типу ордера |
//+------------------------------------------------------------------+
void CloseAll(int ot=-1)
{
bool cl;
int dig=0;
double bid=0,ask=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderType()==0 && (ot==0 || ot==-1))
{
RefreshRates();
bid=MarketInfo(OrderSymbol(),MODE_BID);
dig=(int)MarketInfo(OrderSymbol(),MODE_DIGITS);
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(bid,dig),33,White);
}
if(OrderType()==1 && (ot==1 || ot==-1))
{
RefreshRates();
ask=MarketInfo(OrderSymbol(),MODE_ASK);
dig=(int)MarketInfo(OrderSymbol(),MODE_DIGITS);
cl=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(ask,dig),33,White);
}
}
}
}
void OnTick()

if(TimeCurrent()-OrderOpenTime()>=Exit)
{
CloseAll(0);
}

if(TimeCurrent()-OrderOpenTime()>=Exit)
{
CloseAll(1);
}
Я думаю, что это неправильно.
avatar

Sirojiddin

  • 29 сентября 2021, 05:44
0
Вы меня не поняли.
Например: у меня есть ордер на покупку gbpusd, у меня есть ордер на продажу eurusd, и у меня есть другие ордеры.
Ордер gbpusd закрывается через 4 часа и закрывает все ордеры(Это проблема).

gbpusd должен закрываться через 4 часа и не закрывать другие ордера.
avatar

Sirojiddin

  • 29 сентября 2021, 05:35
0
Ордер необходимо закрыть в определенное время (4 часа) после открытия. Это не должно влиять на другие ордеры.
avatar

Sirojiddin

  • 29 сентября 2021, 04:27
0
avatar

Sirojiddin

  • 29 сентября 2021, 04:22
0
//+------------------------------------------------------------------+
//|                                                AAA+OGNSFA EA.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "AAA"
#property link      "BBB"
#property version   "1.00"
#property strict
//------------------------------------------------------------------

//-----------------------------------------------------------------
//--- Inputs
extern string Expert_settings = "====================Settings====================";
extern double Lots       = 0.01;    
extern double MaxLot     = 1000;
extern double KLot       = 1;
extern int Count         = 1000;    
extern int Exit          = 14400;
extern int StopLoss      = 50000;  
extern int TakeProfit    = 50000;    
extern double KStep      = 1;  
extern int Slip          = 100;  
extern int Magic         = 112233;  
extern string Comments        = "DDSS";
extern string IndName    = "DSS Bressert Arrows TT";
extern int EMAPeriod     =  12;
extern int StochPeriod   =  14;
extern int Shift         = 1;
double marginRequirement, maxLot, minLot, lotSize, points, commissionPoints;
double currentSpread, avgSpread, maxSpread;
int      Ticket;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
 
{
   marginRequirement
= MarketInfo( Symbol(), MODE_MARGINREQUIRED ) * 0.01;
   maxLot
= ( double ) MarketInfo( Symbol(), MODE_MAXLOT );  
   minLot
= ( double ) MarketInfo( Symbol(), MODE_MINLOT );
   
   
   
return(INIT_SUCCEEDED);
 
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
 
{
   
Comment("");
 
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void PutOrder(int type,double price)
 
{
   
int r=0;
   color clr
=Green;
   
double sl=0,tp=0;

   
if(type==1 || type==3 || type==5)
     
{
      clr
=Red;
     
if(StopLoss>0)
         sl
=NormalizeDouble(price+StopLoss*Point,Digits);
     
if(TakeProfit>0)
         tp
=NormalizeDouble(price-TakeProfit*Point,Digits);
     
}

   
if(type==0 || type==2 || type==4)
     
{
      clr
=Blue;
     
if(StopLoss>0)
         sl
=NormalizeDouble(price-StopLoss*Point,Digits);
     
if(TakeProfit>0)
         tp
=NormalizeDouble(price+TakeProfit*Point,Digits);
     
}
 
 
   r
=OrderSend(NULL,type,Lot(type),NormalizeDouble(price,Digits),Slip,sl,tp,Comments,Magic,0,clr);
   
return;
 
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int CountTrades(int type=-1)
 
{
   
int count=0;
   
for(int i=OrdersTotal()-1; i>=0; i--)
     
{
     
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
       
{
         
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           
{
           
if(OrderType()==type || type==-1)
               count
++;
           
}
       
}
     
}
   
return(count);
 
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ModifyOrders()
 
{
   
double allb=0,alls=0;
   
double countb=0,counts=0,tp=0,sl=0;

   
for(int i=OrdersTotal()-1; i>=0; i--)
     
{
     
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
       
{
         
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           
{
           
if(OrderType()==0)
             
{
               allb
+=OrderOpenPrice()*OrderLots();
               countb
+=OrderLots();
             
}

           
if(OrderType()==1)
             
{
               alls
+=OrderOpenPrice()*OrderLots();
               counts
+=OrderLots();
             
}
           
}
       
}
     
}
   
if(countb>0)
      allb
=NormalizeDouble(allb/countb,Digits);
   
if(counts>0)
      alls
=NormalizeDouble(alls/counts,Digits);

   
for(int i=OrdersTotal()-1; i>=0; i--)
     
{
     
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
       
{
         
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
           
{
           
if(OrderType()==OP_BUY)
             
{
               
if(TakeProfit>0)
                  tp
=NormalizeDouble(allb+TakeProfit*Point,Digits);
               
if(StopLoss>0)
                  sl
=NormalizeDouble(allb-StopLoss*Point,Digits);
               
if(OrderTakeProfit()!=tp || OrderStopLoss()!=sl)
                 
bool mod=OrderModify(OrderTicket(),OrderOpenPrice(),sl,tp,0,Yellow);
             
}
           
else
               
if(OrderType()==OP_SELL)
                 
{
                 
if(TakeProfit>0)
                     tp
=NormalizeDouble(alls-TakeProfit*Point,Digits);
                 
if(StopLoss>0)
                     sl
=NormalizeDouble(alls+StopLoss*Point,Digits);
                 
if(OrderTakeProfit()!=tp || OrderStopLoss()!=sl)
                     
bool mod=OrderModify(OrderTicket(),OrderOpenPrice(),sl,tp,0,Yellow);
                 
}
           
}
       
}
     
}
 
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Lot(int type)
 
{
   
double lot=Lots;
   
if(CountTrades(type)>0)
      lot
=NormalizeDouble(Lots*MathPow(KLot,CountTrades(type)),2);
   
if(lot>MaxLot)
      lot
=Lots;
   
return(lot);
 
}


//+------------------------------------------------------------------+
//| Закрытие позиции по типу ордера                                  |
//+------------------------------------------------------------------+
void CloseAll(int ot=-1)
 
{
   
bool cl;
   
int dig=0;
   
double bid=0,ask=0;
   
for(int i=OrdersTotal()-1;i>=0;i--)
     
{
     
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
       
{
         
if(OrderType()==0 && (ot==0 || ot==-1))
           
{
           
RefreshRates();
            bid
=MarketInfo(OrderSymbol(),MODE_BID);
            dig
=(int)MarketInfo(OrderSymbol(),MODE_DIGITS);
            cl
=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(bid,dig),33,White);
           
}
         
if(OrderType()==1 && (ot==1 || ot==-1))
           
{
           
RefreshRates();
            ask
=MarketInfo(OrderSymbol(),MODE_ASK);
            dig
=(int)MarketInfo(OrderSymbol(),MODE_DIGITS);
            cl
=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(ask,dig),33,White);
           
}
       
}
     
}
 
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
 
{


   
double blue1 = iCustom(NULL,0,IndName,EMAPeriod,StochPeriod,1,Shift);
   
double red1  = iCustom(NULL,0,IndName,EMAPeriod,StochPeriod,2,Shift);
   
double blue2 = iCustom(NULL,0,IndName,EMAPeriod,StochPeriod,1,Shift+1);
   
double red2  = iCustom(NULL,0,IndName,EMAPeriod,StochPeriod,2,Shift+1);
   
   
if(CountTrades()<Count)
     
{
     
     
{

   
if((CountTrades(0)<1 && red2>0 && blue1>0))
     
{
     
PutOrder(0,Ask);
     
     
ModifyOrders();
     
}
   
if((CountTrades(1)<1 && red1>0 && blue2>0))
     
{
     
PutOrder(1,Bid);
     
     
ModifyOrders();
     
}
     
}
   
}
   
if(TimeCurrent()-OrderOpenTime()>=Exit)
     
{
     
     
CloseAll();
     
}

   
if(TimeCurrent()-OrderOpenTime()>=Exit)
     
{
     
     
CloseAll();
     
}
 
 
}
//--------------------------------------------
avatar

Sirojiddin

  • 29 сентября 2021, 04:22
0
Одновременно можно открывать ордер по 5-10 пар. Работает всего 24 пары.
avatar

Sirojiddin

  • 29 сентября 2021, 02:55
0
Закрывайте каждый ордер с помощью Magic number.
Напишите мне CloseAll () вот так.
avatar

Sirojiddin

  • 28 сентября 2021, 18:57
Загрузка...