[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 158

 

e.g. so for bystop:

// Step изначально задан в пунктах
  op=MathMax(OrderOpenPrice()+ Step*Point, Ask+MarketInfo(Symbol(), MODE_STOPLEVEL)*Point);
  op=NormalizeDouble( op, Digits)




 

Is it possible to put a condition on this line on Close for an indicator to close orders on, let's say, the

MA>Bid

where should it be inserted if possible, if so is what's below correct? ....


    if ((OrderType()==OP_BUY )&& MA>Bid) OrderClose (OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID), slippage);//правильно ли это?
 
How do I find the maximum/minimum of the previous day?
 
RocketTrend писал(а) >>
How do I find the maximum/minimum of the previous day?
double HighDay=iHigh(NULL,PERIOD_D1,1);
double LowDay=iLow(NULL.PERIOD_D1,1);
 

What's wrong here?

//+------------------------------------------------------------------+
//| RSI+MA.mq4 |
//| Evgenio |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Evgenio"
#property link "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_minimum 20
#property indicator_maximum 80
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 MediumOrchid
//---- input parameters
extern int per_rsi=6;
extern int per_ma=24;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
return(0);
}
int start()
{
int d;
int counted_bars=IndicatorCounted();
//----
for (d=0; d==Bars-counted_bars-1; d++)
{
double ExtMapBuffer1[d]=iRSI(Symbol(),PERIOD_H1,per_rsi,PRICE_CLOSE,0);
}
for (d=0; d==Bars-counted_bars-1; d++)
{
double ExtMapBuffer2[d]=iMAOnArray(ExtMapBuffer1,0,per_ma,0,MODE_EMA,0);
}
//----
return(0);
}
//+------------------------------------------------------------------+

here is the compiler log not like indexes and brackets why ?

'd' - integer number expected C:\Program Files\MetaTrader - Alpari\experts\indicators\RSI+MA.mq4 (42, 25)
']' - comma or semicolon expected C:\Program Files\MetaTrader - Alpari\experts\indicators\RSI+MA.mq4 (42, 26)
'd' - integer number expected C:\Program Files\MetaTrader - Alpari\experts\indicators\RSI+MA.mq4 (46, 25)
']' - comma or semicolon expected C:\Program Files\MetaTrader - Alpari\experts\indicators\RSI+MA.mq4 (46, 26)


 

Already found the error thanks for your attention

 
1Rakso >> :

Is it possible to put a condition on this line on Close for an order to be closed by, let's say, a

where should it be inserted if possible, if so is it correct what's below? ....



--

//----------------------------------------------------------------------
  for (int v=0; v<OrdersTotal(); v++)     { //задаем перебор ордеров      
      if (OrderSelect( v, SELECT_BY_POS, MODE_TRADES))  {//выбираем из откр. поз           
        if (OrderSymbol()==Symbol()&& OrderMagicNumber()== MagicNumber)   { 
//если символ соответствует графику 
// и магик соответствует заданному   
//-----------------------------------------------------                  
if (OrderType() == OP_BUY) { //если это - позиция БАЙ
      if( MA>Bid  )     {
           OrderClose(OrderTicket(),OrderLots(),Bid,3,Green); // закрываем позицию
                // return(0); // выходим
                }       
     }  
 //--------------------------------------------------------
if (OrderType() == OP_SELL) { //если это позиция СЕЛЛ
      if( MA<Bid )    {
                 OrderClose(OrderTicket(),OrderLots(),Ask,3,Green); // закрываем позицию
                // return(0); // выходим
                }       
     }  
 //-------------------------------------------------------                       
    }  // Symbol()  
  } // select
 } //total
 
rid >> :

--


>> : : : : : : : : : : : . >>Thank you for your help)


 
rid >> :

--

//----------------------------------------------------------------------
  for (int v=0; v<OrdersTotal(); v++)     { //задаем перебор ордеров      
      if (OrderSelect( v, SELECT_BY_POS, MODE_TRADES))  {//выбираем из откр. поз           
        if (OrderSymbol()==Symbol()&& OrderMagicNumber()== MagicNumber)   { 
//если символ соответствует графику 
// и магик соответствует заданному   
//-----------------------------------------------------                  
if (OrderType() == OP_BUY) { //если это - позиция БАЙ
      if( MA>Bid  )     {
           OrderClose(OrderTicket(),OrderLots(),Bid,3,Green); // закрываем позицию
                // return(0); // выходим
                }       
     }  
 //--------------------------------------------------------
if (OrderType() == OP_SELL) { //если это позиция СЕЛЛ
      if( MA<Bid )    {
                 OrderClose(OrderTicket(),OrderLots(),Ask,3,Green); // закрываем позицию
                // return(0); // выходим
                }       
     }  
 //-------------------------------------------------------                       
    }  // Symbol()  
  } // select
 } //total

1) How do you make it switchable, through external variables?

2) Can I set it so that the first open order would be closed, and the next orders 2, 3 etc. would not be closed? Suppose I open a Buy order - this is the first order, then I open one more Buy order - the second one, etc. and then out of this series of orders only the 1st order would be closed by СorderClose?

[Deleted]  

Hello, everyone ))))

Help.

mql4 is just starting to program.

Writing an Expert Advisor.

i have a question: How do i do this?

I would like my EA to work on Mondays only. i would like it to open only 1 order on monday if i close it then it shuts down until monday.

I have a new bar open at 9.00 on Monday.

How do I determine the opening price and store it in a variable?