[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 1012

 
boris.45:

THANK YOU

So download the data. Press F2, select a pair and download the entire history on M1
 

Hello!

Can you please advise how to implement a comparison of indicator values with the price of different time intervals (timeframe???????) in an EA. I am pasting the code. Search did not give anything, as much as I could read this thread (with 940). Thanks in advance!!!

//+------------------------------------------------------------------+
//|                                        expert SAR_1_5_15 min.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//---- input parameters
extern double    Lots=0.01;
extern int       StopLoss=300;
extern int       TakeProfit=150;
extern int       MagicNumber=123456;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
  
bool CheckOrders(int Type)
{
 bool Result=True;
 for(int i=0;i<OrdersTotal();i++)
  if(OrderSelect(i,SELECT_BY_POS))
   if(OrderMagicNumber()==MagicNumber && OrderSymbol() == Symbol())
      if(OrderType()==Type)
        {
         if(Type==OP_BUY)
           if(!OrderClose(OrderTicket(),OrderLots(),Bid,0))
             Result=False;
         if(Type==OP_SELL)
           if(!OrderClose(OrderTicket(),OrderLots(),Ask,0))
             Result=False;
         } 
        else Result=False;
 return(Result); 
}

// Проверяем наличие закрытой на текущей свече позиции типа Type. Если есть, то возвращает False  
bool CheckExists(int Type)  
{
 bool Result=True;
 for(int i=OrdersHistoryTotal()-1; i>=0;i--)
  if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
   if(OrderMagicNumber()==MagicNumber&&OrderSymbol()==Symbol()&&OrderCloseTime()>=Time[0]&&OrderType()==Type)
    {
     Result=False;
     break;
     }
 return(Result); 
 }
  
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
    // Узнаем уровень стопов и спрэд
    int Spread = MarketInfo(Symbol(), MODE_SPREAD);
    int StopLevel = MarketInfo(Symbol(), MODE_STOPLEVEL);

    // Рассчитываем значения Parabolic,на 0-ом, 1-ом и 2-м барах для 1,5-ти,15-ти минутн. графиков
    double sar10 = iSAR(NULL,1,0.02,0.2,0);
    double sar11 = iSAR(NULL,1,0.02,0.2,1);
    double sar50 = iSAR(NULL,5,0.02,0.2,0);
    double sar51 = iSAR(NULL,5,0.02,0.2,1);
    double sar150 = iSAR(NULL,15,0.02,0.2,0);
    double sar151 = iSAR(NULL,15,0.02,0.2,1);
    double sar152 = iSAR(NULL,15,0.02,0.2,2);
        
   //-------------открытие позиции Buy покупка----------------- 
    if(
    (sar10>Open[0])&&    //  SAR 1 // сравниваем с ценой открытия
    (sar11>Close[0+1])&&    // минута и сравниваем с ценой закрытия
    (sar50>Open[0])&&         //  SAR 5
    (sar51>Close[0+1])&&      // минут
    (sar150>Open[0])&&        //  SAR 15
    (sar151>Close[0+1])&&    // минут
    (sar152<Close[0+2])      // начало тренда
    )
     if(CheckOrders(OP_SELL) && CheckExists(OP_BUY))
      {
       if(StopLoss <= StopLevel+Spread)
         double SL = 0;
        else
         SL = Ask - StopLoss*Point;
       if(TakeProfit <= StopLevel-Spread)
         double TP = 0;
        else
         TP = Ask + TakeProfit*Point;
       if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 10, SL, TP, NULL, MagicNumber))
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
       }
    //-------------------Конец блока покупки -------------------
    
    //-------------Открытие позиции Sell продажа----------------  
    if(
    (sar10<Open[0])&&       //  SAR 1
    (sar11<Close[0+1])&&    // минут
    (sar50<Open[0])&&       //  SAR 5
    (sar51<Close[0+1])&&    // минут
    (sar150<Open[0])&&        //  SAR 15
    (sar151<Close[0+1])&&     // минут
    (sar153>Close[0+2])      // начало тренда
    )
     if(CheckOrders(OP_BUY) && CheckExists(OP_SELL))
      {
       if(StopLoss <= StopLevel+Spread)
         SL = 0;
        else
         SL = Bid + StopLoss*Point;
       if(TakeProfit <= StopLevel-Spread)
         TP = 0;
        else
         TP = Bid - TakeProfit*Point;
       if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 10, SL, TP, NULL, MagicNumber))
         Print("Не открыт ордер Sell. Ошибка №", GetLastError()); 
       }

//-----------------конец блока продажи ----------------------
   return(0);
  }
//+------------------------------------------------------------------+
 
Hello, respected programmers!
I have an EA that trades by the wagons. The problem is that it does not always open and close positions correctly, I think because of slippage. Please add the Slippage parameter to the EA. Thank you
Files:
 

Hi all!

Can you please tell me how to set up this EA? https://www.mql5.com/ru/code/9434

I want it to open hedging position or close position with profit if it reaches certain minus or plus.

I don't know where to change parameters.

There are parameters there: profitplus 1.0

profitminus -1.0

profit 1.0

I do not know where to change it.

I do not know where to change the parameters.

 

Can you tell me where to find an EA that opens a position at the opening of a daily candle?

cp.

 
glasha:
Hello, respected programmers!
I have an EA that trades by the wagons. The problem is that it does not always open and close positions correctly, I think because of slippage. Please add the Slippage parameter to the EA. Thank you
Files:
 
igrok2008:

Hello!

Can you please advise how to implement a comparison of indicator values with the price of different time intervals (timeframe???????) in the Expert Advisor. I am pasting the code. Search did not give anything, as much as I could read this thread (with 940). Thanks in advance!

As far as I understand this is where it is compared. If I am mistaken, let them correct me.

if(
(sar10>Open[0])&& // SAR 1 // compare with opening price
(sar11>Close[0+1])&& // compare with closing price
(sar50>Open[0])&& // SAR 5
(sar51>Close[0+1])&& // minutes
(sar150>Open[0])&& // SAR 15
(sar151>Close[0+1])&& // minutes
(sar152<Close[0+2]) // trend start
)

 

1. how the programme is coordinated in different timeframes on a real or a tester.

Example: on the hour, we watch and look for a trend, on the half-hour and below the (.) entry/exit.

Thank you.

 
Good afternoon people, please advise how I can make this EMA crossover signal indicator so that at each crossing it emits not one beep but as many as I want?
 
x8profit:
Hello, guys, can you tell me how to make this EMA crossover signal indicator so that at each crossover it emits not one beep but as many beeps as I want?

I didn't look at the code, but the first thing that came to my mind: in the part of the code where one beep is generated, make a loop and output the number of its iterations to the external. The signal will be output as many times as you set in the settings...

Although... It will be a pause in the work of the indicator with the duration of the signal *number of iterations of the cycle.

Reason: