Download MetaTrader 5
MQL5 ReferenceCustom SymbolsCustomSymbolSetSessionQuote 

CustomSymbolSetSessionQuote

Sets the start and end time of the specified quotation session for the specified symbol and week day.

bool  CustomSymbolSetSessionQuote(
   const string      symbol_name,         // symbol name
   ENUM_DAY_OF_WEEK  day_of_week,         // week day
   uint              session_index,       // session index
   datetime          from,                // session start time
   datetime          to                   // session end time
   );

Parameters

symbol_name

[in]  Custom symbol name.

ENUM_DAY_OF_WEEK

[in]  Week day, value from the ENUM_DAY_OF_WEEK enumeration.

uint

[in]  Index of the session, for which start and end times are to be set. Session indexing starts from 0.

from

[in]  Session start time in seconds from 00:00, data value in the variable is ignored.

to

[in]  Session end time in seconds from 00:00, data value in the variable is ignored.

Return Value

true — success, otherwise — false. To get information about the error, call the GetLastError() function.

Note

If the session with the specified session_index already exists, the function simply edits the beginning and end of the session.

If zero start and end parameters have been passed for the session (from=0 and to=0), the appropriate session with the session_index is deleted, while the session indexing is shifted downwards.

Sessions can be added only sequentially. In other words, you can add session_index=1 only if the session with the index 0 already exists. If this rule is broken, a new session is not created, while the function itself returns 'false'.

See also

SymbolInfoSessionQuote, Symbol info, TimeToStruct, Date structure