Download MetaTrader 5
To add comments, please log in or register
Why to sell products in MetaTrader AppStore? Find that out from the article!
Automated-Trading 2016.01.20 09:57 

TradeState - the EA trading mode switcher depending on the time:

The class restricts the EA trading by time. It has flexible configuration options, which allow to set a custom number of the time zones, and also to allow trading only on the specified week days.

//| Sets the trade state TradeState                                  |
//| INPUT:                                                           |
//| time_begin  - Time, from which the trade state starts            |
//|               functioning.                                       |
//| time_end    - Time, until which the trade state functions        |
//| day_of_week - Day of the week, to which the setting of trade     |
//|               state is applied to. Corresponds to the modifiers  |
//|               ENUM_DAY_OF_WEEK or the modifier ALL_DAYS_OF_WEEK  |
//| state       - The trade state.                                   |
//| Warning, date component in time_begin and time_end is ignored.   |
void CTradeState::SetTradeState(datetime time_begin,datetime time_end, int day_of_week, ENUM_TRADE_STATE state);

Author: Vasiliy Sokolov

To add comments, please log in or register