85 lines
8.3 KiB
MQL5
85 lines
8.3 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| TradingEngineEnums.mqh |
|
|
//| Copyright © 2019, Vladimir Karputov |
|
|
//| http://wmua.ru/slesar/ |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright © 2019, Vladimir Karputov"
|
|
#property link "http://wmua.ru/slesar/"
|
|
#property version "3.116"
|
|
//+------------------------------------------------------------------+
|
|
//| Enum Lor or Risk |
|
|
//+------------------------------------------------------------------+
|
|
enum ENUM_LOT_OR_RISK
|
|
{
|
|
lots_min=0, // Lots Min
|
|
lot=1, // Constant lot
|
|
risk=2, // Risk in percent for a deal
|
|
};
|
|
//+------------------------------------------------------------------+
|
|
//| Enum Trade Mode |
|
|
//+------------------------------------------------------------------+
|
|
enum ENUM_TRADE_MODE
|
|
{
|
|
buy=0, // Allowed only BUY positions
|
|
sell=1, // Allowed only SELL positions
|
|
buy_sell=2, // Allowed BUY and SELL positions
|
|
};
|
|
//--- the tactic is this: for positions we strictly monitor the result,
|
|
//--- and pending orders (if the spread was verified)
|
|
//--- just shoot and zero out the arrays of structures
|
|
//+------------------------------------------------------------------+
|
|
//| Structure Positions |
|
|
//+------------------------------------------------------------------+
|
|
struct STRUCT_POSITION
|
|
{
|
|
ENUM_POSITION_TYPE pos_type; // position type
|
|
double volume; // position volume (if "0.0" -> the lot is "Money management")
|
|
double lot_coefficient; // lot coefficient
|
|
bool waiting_transaction; // waiting transaction, "true" -> it's forbidden to trade, we expect a transaction
|
|
ulong waiting_order_ticket; // waiting order ticket, ticket of the expected order
|
|
bool transaction_confirmed; // transaction confirmed, "true" -> transaction confirmed
|
|
//--- Constructor
|
|
STRUCT_POSITION()
|
|
{
|
|
pos_type = WRONG_VALUE;
|
|
volume = 0.0;
|
|
lot_coefficient = 0.0;
|
|
waiting_transaction = false;
|
|
waiting_order_ticket = 0;
|
|
transaction_confirmed = false;
|
|
}
|
|
};
|
|
//+------------------------------------------------------------------+
|
|
//| Structurt Pending |
|
|
//+------------------------------------------------------------------+
|
|
struct STRUCT_PENDING
|
|
{
|
|
ENUM_ORDER_TYPE pending_type; // pending order type
|
|
double volume; // pending order volume
|
|
double price; // pending order price
|
|
double stop_loss; // pending order stop loss, in pips * m_adjusted_point (if "0.0" -> the m_stop_loss)
|
|
double take_profit; // pending order take profit, in pips * m_adjusted_point (if "0.0" -> the m_take_profit)
|
|
double indent; // pending indent, in pips * m_adjusted_point
|
|
long expiration; // expiration (extra time)
|
|
//--- Constructor
|
|
STRUCT_PENDING()
|
|
{
|
|
pending_type = WRONG_VALUE;
|
|
volume = 0.0;
|
|
price = 0.0;
|
|
stop_loss = 0.0;
|
|
take_profit = 0.0;
|
|
indent = 0.0;
|
|
expiration = 0;
|
|
}
|
|
};
|
|
//+------------------------------------------------------------------+
|
|
//| Type of Regression Channel |
|
|
//+------------------------------------------------------------------+
|
|
enum ENUM_Polynomial
|
|
{
|
|
linear=1, // linear
|
|
parabolic=2, // parabolic
|
|
Third_power=3, // third-power
|
|
};
|
|
//+------------------------------------------------------------------+
|