Questions from Beginners MQL5 MT5 MetaTrader 5 - page 516

 
Artyom Trishkin:
SymbolInfoDouble(Symbol(),SYMBOL_ASK);

Is this a question? If so, here is an example on MT4

//+------------------------------------------------------------------+
//|                                                       тест 2.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
Print("ask = ",ask);

MqlTick last_tick;

if(SymbolInfoTick(Symbol(),last_tick)) 
     { 
      Print(last_tick.time,": Bid = ",last_tick.bid, 
            " Ask = ",last_tick.ask,"  Volume = ",last_tick.volume); 
     } 
   else Print("SymbolInfoTick() failed, error = ",GetLastError()); 
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

Result

0       22:40:49.415    Script тест 2 EURUSD,H1: loaded successfully
0       22:40:49.446    тест 2 EURUSD,H1: initialized
0       22:40:49.447    тест 2 EURUSD,H1: ask = 1.11422
0       22:40:49.447    тест 2 EURUSD,H1: 2016.02.16 17:40:51: Bid = 1.11412 Ask = 1.11422  Volume = 0
0       22:40:49.447    тест 2 EURUSD,H1: uninit reason 0
0       22:40:49.448    Script тест 2 EURUSD,H1: removed
 
Hello. Can youwrite an EA for this indicator? The indicator can draw until the close of the candle, as the candle closed arrow is not missing. Can we make the order open after fixing the arrow indicator? Ie on the next candle after the arrow. Fixed lot and the ability to transfer to Breakeven trades after a specified number of points. I would be very grateful!demonoid123000@mail.ru
Files:
trendignal_alert.mq45 kb
trendignal_alert.ex415 kb
 

Please help.

 
Sergey Gritsay:

Is this a question? If so, here is an example on MT4

Result

Nah, it's not a question... I wanted to answer the person who asked how to get an Ask. Without avatars, it's hard to see who's asking and who's answering, and who's answering too. Sorry.
 
Sergey Gritsay:

I think this would be more interesting

version 1

version 2

More interesting, but not clear, for beginners - that's me...
 
-Aleks-:
More interesting, but not clear, for beginners - that's me...

This is a custom function, here's an example of how to use it

//+------------------------------------------------------------------+
//|                                                        тест3.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   if(NevDay1())
     {
      Alert("Наступил новый день");
     }

   if(NevDay2())
     {
      Alert("Наступил новый день");
     }

  }
//+------------------------------------------------------------------+
bool NevDay1()
  {
   static datetime StatTime;

   if(StatTime!=iTime(NULL,PERIOD_D1,0))
     {
      StatTime=iTime(NULL,PERIOD_D1,0);
      return(true);
     }
   return(false);
  }
//+------------------------------------------------------------------+
bool NevDay2()
  {
   static int den;

   if(den!=Day())
     {
      den=Day();
      return(true);
     }
   return(false);
  }
//+------------------------------------------------------------------+
 
Sergey Gritsay:

This is a custom function, here is an example of how to use it

I understand that it's a custom function.

In the second example it is not clear where the Day() function sends to

 
-Aleks-:

I understand that it's a custom function.

In the second example, it's not clear where the Day() function sends

What do you mean where? This is the function from the documentation

Day

It returns the current day of the month, i.e. the day of the month of the last known server time.

intDay();

Returned value

The current day of the month.

Note

During testing, the last known server time is simulated.

Example:

if(Day()<5)return(0);

 
Sergey Gritsay:

What do you mean where? It's a function from the documentation.

Day

Returns the current day of the month, i.e. the day of the month of the last known server time.

intDay();

Returned value

The current day of the month.

Note

During testing, the last known server time is simulated.

Example:

if(Day()<5)return(0);

Wow I'm dark - thanks for the enlightenment - didn't know.

Time to teach the forum to highlight functions in full!

 
Guys, help me write a simple Expert Advisor! I would be very grateful!!!