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

 
E_mc2 >> :

If you're worried about oversleeping then change this line

\ if ( WarningMode>0 ) PlaySound(soundfile); \

indicator to this one

\ if ( WarningMode>0 && shift==0) GlobalVariableSet("Alarm",1); \

and create an indicator like this

int start()
{if(GlobalVariableGet("Будильник"))PlaySound("news.wav");
return(0);
}

And when you fall asleep you not only set the main indicator but also the alarm clock.

The alarm clock can be switched off manually by changing the value 0 in the Alarm clock variable via the F3 key.

 
Urain >> :

What do you need it for? Tell me more about it, maybe there's a solution, and you don't know how to ask the right questions so people understand.

I have two solutions for what you wrote, it would take too long to write two at once :)

..

By the way, it's better to attach such long codes as a file.

And for the code there is a special button SRC

Yeah, I need it so I don't miss the signal.) Only once the alarm goes off, it's easy to miss it especially at night((( And what does it mean - alarm??? What will happen?

I changed the line... I created a new indicator Alarm..... but I don't understand... it works all the time regardless of whether the indicator gives out a signal or not... Even if there is no signal from the indicator, the alarm clock beeps continuously)))) There is no signal, but the alarm clock works...

 
E_mc2 >> :

I need it so I don't miss the signal)) It only sounds an alert once, easy to miss especially at night((( And what does it mean - alarm??? What will happen?

Change the line in your indicator as described above.

Compile and run the attached indicator.

It will ring on every tick, until you disable the indicator or reset the "Alarm" global variable

Files:
wxinptvxq.mq4  1 kb
 

Moving Average Expert Advisor.

I have inserted functions KimIV to open an order (GetSizeLot() OpenPosition CorrectTF(int TimeFrame=0) GetNameOP(int op) ModifyOrder() ExistPositions() Message()). Hadn't reached the closing yet. I have created its own indicator data function void Indicat_Var(), to have indicator data in one place and to use it at any place of the program.

When you access with function CheckForOpen() to Indicat_Var() everything is fine, but when you access with function CheckForClose() to Indicat_Var() orders are not closed I don't understand why

I also think that functions CalculateCurrentOrders(string symbol) and ExistPositions() duplicate each other.

Please help me understand

Files:
magkimiv.mq4  15 kb
 

The lot calculation function was originally provided in the EA. If you added another one(GetSizeLot()), then (at least) remove the original one - LotsOptimized()

//------------------------------------------------

Indeed. Functions that determine the presence of open positions duplicate each other.

One of them can be removed. (Learn how they differ, and which one you need more!)

//--------------------------------------------

See https://www.mql5.com/ru/articles/1385

There, just there, is a modification of this EA with Russian comments in the code.

Modification, - Exactly, by closing.

 

Do we mark the OPEN and CLOSE POINTS on the chart?

Question to the pros - is there such an indicator or script,

which draws the open and close points on the chart?

of an order? It connects them with a line,

The red one is a loss. Useful for analysing errors on history!

 

I think you have already been asked this question.

You can drag a trade directly from the account history to the relevant chart with your mouse.

And you will get what you are looking for.

I saw the script somewhere. I think I.Kim had such a script.

http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=32

 

Asking for help from connoisseurs on the Cursor with a price,

Thank you!

 

Please help me to understand why my open orders do not close when the trend changes (open conditions). And how can i fix this error!

The code is like this for me:

extern int TP=40;            //уровень Take Profit
extern int SL=0;              //уровень Stop Loss
extern double Lots1=0.2;      //лот основной сделки
extern double Lots2=0.1;      //лот вспомогательных сделок 
extern int slippage=2;        //проскальзование
int MagicNumber1=5345; //магическое число сделки BUY
int MagicNumber2=1612; //магическое число сделки SELL
// переменная для пятизнаков
int BrokerDecimal = 1;
// и просто нужные переменные (типа флажки)
double ticketbuy;
double ticketsell;



int init()
  {
  // Если брокер дает котировки по валюте с точностью в пять или три знака - пипс будет меньше стандартного в 10 раз - вводим множитель   
  if(Digits==3 || Digits==5) BrokerDecimal=10; 
  // Перемножить все уровни в пипсах на множитель
  SL           = SL * BrokerDecimal; 
  TP           = TP * BrokerDecimal;
  return(0);
  }

int start()
  {
  // Рассчеты и анализ индикаторов
  double jaw=iAlligator(NULL,0,13,8,8,5,5,3,MODE_SMMA,PRICE_MEDIAN, MODE_GATORJAW,1); //синяя линия (челюсть)
  double teen=iAlligator(NULL,0,13,8,8,5,5,3,MODE_SMMA,PRICE_MEDIAN, MODE_GATORTEETH,1);//красная линия (зубы)
  double lips=iAlligator(NULL,0,13,8,8,5,5,3,MODE_SMMA,PRICE_MEDIAN, MODE_GATORLIPS,1);//зеленая линия (губы)
  
  double lastClose=iClose(NULL,0,1);
  
  
  // Собственно тело программы  
  if((OrderSelect( ticketbuy, SELECT_BY_TICKET, MODE_TRADES) == false || OrderCloseTime() > 0 )
    && lips> jaw && lastClose> lips) // условие выставления ордеров БАЙ
    SEND_BUY(); // вынесем "модуль" выставления ордера бай - добавить внизу
  
  if((OrderSelect( ticketsell, SELECT_BY_TICKET, MODE_TRADES) == false || OrderCloseTime() > 0 )
    && jaw> lips && lastClose< jaw) // условие выставления ордеров СЕЛЛ
    SEND_SELL(); // вынесем "модуль" выставления ордера сэлл - добавить внизу
  
  if (OrdersTotal()>=1)
      {
        if(OrderSelect(0, SELECT_BY_POS, MODE_TRADES))
          {
            if(OrderType()==OP_BUY)
              {
                if(( lips== jaw || lips== teen) && lastClose== lips) // условия закрытия сделки БАЙ
                  while(OrdersTotal()>0)
                    {
                      CloseDirect(0,"Принудительное закрытие сделки при обратном движении рынка, ticket=");
                    }
              }
            if(OrderType()==OP_SELL)
              {
                if(( jaw== lips || jaw== teen) && lastClose== jaw) // условия закрытия сделки СЕЛЛ
                  while(OrdersTotal()>0)
                    {
                      CloseDirect(0,"Принудительное закрытие сделки при обратном движении рынка, ticket=");
                    }
              }
          }
        else
          {
            Print("ОШИБКА в Start()(блок закрытия при обратном движении) :OrderSelect() - ",GetLastError());
            return(-1);
          }
      }
         
  return(0);
  }

// "модуль" выставления ордера бай
void SEND_BUY()
  {
  double sl_buy;
  if(! SL)
  { 
  sl_buy=0;
  }
    else
    {
    sl_buy=Ask- SL*Point;
    }
    ticketbuy=OrderSend(Symbol(),OP_BUY, Lots1,Ask, slippage, sl_buy,Ask+ TP*Point,"take_trend", MagicNumber1,0,Blue);
          if( ticketbuy == -1)
          {
          Alert(Symbol(),"ошибка:бай", GetLastError());
          return(-1);
          }
            if( ticketbuy > 1)
            Alert (Symbol(),"бай - ок !");
  }

// "модуль" выставления ордера сэлл
void SEND_SELL()
  {
  double sl_sell;
  if(! SL)
  { 
  sl_sell=0;
  }
   else
   {
   sl_sell=Bid+ SL*Point;
   }
   ticketsell=OrderSend(Symbol(),OP_SELL, Lots1,Bid, slippage, sl_sell,Bid- TP*Point,"take_trend", MagicNumber2,0,Red);
         if( ticketsell == -1)
         {
         Alert(Symbol(),"ошибка:сэлл", GetLastError());
         return(-1);
         }
           if( ticketsell > 1)
           Alert (Symbol(),"сэлл - ок !");
   }

// МОДУЛЬ ЗАКРЫТИЯ СДЕЛОК ПРИ СМЕНЕ ТРЕНДА 
void CloseDirect(int cntr, string comm)
  {
    double closeprice;
    if(OrderSelect( cntr, SELECT_BY_POS, MODE_TRADES))
      {
        RefreshRates();
        if (OrderType()==OP_BUY)
          closeprice=Bid;
        else
          closeprice=Ask;
        if (OrderClose(OrderTicket(),OrderLots(), closeprice,10,Green))
        {
          Print( comm, OrderTicket());
        }
        else
          {
            Print("ОШИБКА в CloseDirect():OrderClose() - ",GetLastError());
          }
      }
    else
      {
        Print("ОШИБКА в CloseDirect():OrderSelect() - ",GetLastError());
      }
  }
 

Can you please tell me how to get a signal from a smoothed rsi? (MA => RSI).

Reason: