Ating for MQL5
Loading...
Searching...
No Matches
Transaction Class Reference

Class to handle trading transactions, inheriting from Request. More...

+ Inheritance diagram for Transaction:
+ Collaboration diagram for Transaction:

Public Types

enum  ENUM_CHECK { CHECK_ARG_TRANSACTION_PASSED , ERR_SYMBOL_NOT_AVAILABLE , ERR_INVALID_LOT_SIZE , ERR_DEVIATION_INSUFFICIENT }
 Enum to handle different types of check transactions. More...
 
enum  ENUM_ORDER_TRANSACTION { ORDER_PLACED_SUCCESSFULLY = 1 , ERR_SEND_FAILED = 0 }
 Enum to handle different types of order transactions. More...
 
enum  ENUM_FIX_FILLING_MODE { FILLING_MODE_FOUND , ERR_FILLING_MODE_NO_FOUND , ERR_INVALID_REQUEST }
 Enum to handle different types of fix filling modes. More...
 
- Public Types inherited from Request
enum  ENUM_ORDER_PENDING_TYPE { ORDER_PENDING_TYPE_BUY = POSITION_TYPE_BUY , ORDER_PENDING_TYPE_SELL = POSITION_TYPE_SELL }
 Enum for pending order types. More...
 
enum  ENUM_PRIVATE_ATR_STRING { SYMBOL }
 Enum for private string attributes. More...
 
enum  ENUM_PRIVATE_ATR_DOUBLE { LOT_SIZE }
 Enum for private double attributes. More...
 
enum  ENUM_PRIVATE_ATR_ULONG { TAKE_PROFIT , STOP_LOSS , DEVIATION_TRADE , MAGIC_NUMBER }
 Enum for private ulong attributes. More...
 

Public Member Functions

 Transaction (void)
 Constructor for the Transaction class.
 
ENUM_CHECK CheckArg ()
 Checks the arguments for the transaction.
 
void Update ()
 Updates the transaction parameters.
 
ENUM_FIX_FILLING_MODE FixFillingMode ()
 Fixes the filling mode for the transaction.
 
ENUM_ORDER_TRANSACTION SendPosition (ENUM_POSITION_TYPE order_type)
 Sends a position order for the transaction.
 
ENUM_ORDER_TRANSACTION SendPendingDefault (double open_price, ENUM_ORDER_PENDING_TYPE order_type)
 Sends a pending order with default parameters for the transaction.
 
ENUM_ORDER_TRANSACTION SendPendingOrPosition (double open_price, double comparative_price, ENUM_ORDER_PENDING_TYPE order_type)
 Sends a pending or position order for the transaction.
 
string EnumCheckTransactionToString (ENUM_CHECK enum_result)
 Converts the check transaction result to a string.
 
string EnumOrderTransactionToString (ENUM_ORDER_TRANSACTION enum_result)
 Converts the order transaction result to a string.
 
string EnumFixFillingModeToString (ENUM_FIX_FILLING_MODE enum_result)
 Converts the fix filling mode result to a string.
 
string CommentToShow ()
 Returns a formatted string with details of the transaction.
 
- Public Member Functions inherited from Request
 Request ()
 Default constructor for the Request class.
 
void UpdateAtr (string symbol_arg, double lot_size_arg, uint take_profit_arg, uint stop_loss_arg, uint deviation_trade_arg, ulong magic_number_arg)
 Updates the attributes of the request.
 
string GetPrivateAtr (ENUM_PRIVATE_ATR_STRING atr)
 Gets the private string attribute.
 
double GetPrivateAtr (ENUM_PRIVATE_ATR_DOUBLE atr)
 Gets the private double attribute.
 
ulong GetPrivateAtr (ENUM_PRIVATE_ATR_ULONG atr)
 Gets the private ulong attribute.
 
void BuildCheckPosition (MqlTradeRequest &request, ENUM_POSITION_TYPE type, ENUM_ORDER_TYPE_FILLING filling)
 Builds a check position.
 
void BuildPosition (MqlTradeRequest &request, ENUM_POSITION_TYPE type, ENUM_ORDER_TYPE_FILLING filling)
 Builds a position.
 
void BuildPending (MqlTradeRequest &request, ENUM_ORDER_PENDING_TYPE type, ENUM_ORDER_TYPE_FILLING filling, double price)
 Builds a pending order.
 
void BuildPendingOrPosition (MqlTradeRequest &request, ENUM_ORDER_PENDING_TYPE type, ENUM_ORDER_TYPE_FILLING filling, double price)
 Builds a pending order or position.
 

Public Attributes

MqlTradeRequest tradeRequest
 
MqlTradeResult tradeResult
 
MqlTradeCheckResult tradeCheckResult
 
- Public Attributes inherited from Request
string symbol
 
double lotSize
 
ulong takeProfit
 
ulong stopLoss
 
ulong deviationTrade
 
ulong magicNumber
 
RoundVolume roundVolume
 
CalcStop calcStop
 

Protected Member Functions

string failSendingOrder ()
 Returns a formatted string describing the failure of sending an order.
 

Protected Attributes

double priceAsk
 
double priceBid
 
double tickSize
 
ENUM_ORDER_TYPE_FILLING typeFilliingMode
 

Detailed Description

Class to handle trading transactions, inheriting from Request.

Member Enumeration Documentation

◆ ENUM_CHECK

Enum to handle different types of check transactions.

Enumerator
CHECK_ARG_TRANSACTION_PASSED 

Check transaction passed

ERR_SYMBOL_NOT_AVAILABLE 

Error: Symbol not available

ERR_INVALID_LOT_SIZE 

Error: Invalid lot size

ERR_DEVIATION_INSUFFICIENT 

Error: Insufficient deviation

◆ ENUM_FIX_FILLING_MODE

Enum to handle different types of fix filling modes.

Enumerator
FILLING_MODE_FOUND 

Filling mode found

ERR_FILLING_MODE_NO_FOUND 

Error: Filling mode not found

ERR_INVALID_REQUEST 

Error: Invalid request

◆ ENUM_ORDER_TRANSACTION

Enum to handle different types of order transactions.

Enumerator
ORDER_PLACED_SUCCESSFULLY 

Order placed successfully

ERR_SEND_FAILED 

Error: Send failed

Constructor & Destructor Documentation

◆ Transaction()

Transaction::Transaction ( void )
inline

Constructor for the Transaction class.

Member Function Documentation

◆ CheckArg()

Transaction::ENUM_CHECK Transaction::CheckArg ( )

Checks the arguments for the transaction.

Returns
The result of the check as ENUM_CHECK.

◆ CommentToShow()

string Transaction::CommentToShow ( )

Returns a formatted string with details of the transaction.

Returns
A string with details of the transaction.

◆ EnumCheckTransactionToString()

string Transaction::EnumCheckTransactionToString ( ENUM_CHECK enum_result)

Converts the check transaction result to a string.

Parameters
enum_resultThe result of the check transaction.
Returns
A string representing the check transaction result.

◆ EnumFixFillingModeToString()

string Transaction::EnumFixFillingModeToString ( ENUM_FIX_FILLING_MODE enum_result)

Converts the fix filling mode result to a string.

Parameters
enum_resultThe result of the fix filling mode.
Returns
A string representing the fix filling mode result.

◆ EnumOrderTransactionToString()

string Transaction::EnumOrderTransactionToString ( ENUM_ORDER_TRANSACTION enum_result)

Converts the order transaction result to a string.

Parameters
enum_resultThe result of the order transaction.
Returns
A string representing the order transaction result.

◆ failSendingOrder()

string Transaction::failSendingOrder ( )
protected

Returns a formatted string describing the failure of sending an order.

Returns
A string with details of the failed order.
+ Here is the caller graph for this function:

◆ FixFillingMode()

Transaction::ENUM_FIX_FILLING_MODE Transaction::FixFillingMode ( )

Fixes the filling mode for the transaction.

Returns
The result of fixing the filling mode as ENUM_FIX_FILLING_MODE.
+ Here is the call graph for this function:

◆ SendPendingDefault()

Transaction::ENUM_ORDER_TRANSACTION Transaction::SendPendingDefault ( double open_price,
ENUM_ORDER_PENDING_TYPE order_type )

Sends a pending order with default parameters for the transaction.

Parameters
open_priceThe price at which the pending order will open.
order_typeThe type of pending order.
Returns
The result of sending the order as ENUM_ORDER_TRANSACTION.
+ Here is the call graph for this function:

◆ SendPendingOrPosition()

Transaction::ENUM_ORDER_TRANSACTION Transaction::SendPendingOrPosition ( double open_price,
double comparative_price,
ENUM_ORDER_PENDING_TYPE order_type )

Sends a pending or position order for the transaction.

Parameters
open_priceThe price at which the order will open.
comparative_priceThe comparative price for the order.
order_typeThe type of pending order.
Returns
The result of sending the order as ENUM_ORDER_TRANSACTION.
+ Here is the call graph for this function:

◆ SendPosition()

Transaction::ENUM_ORDER_TRANSACTION Transaction::SendPosition ( ENUM_POSITION_TYPE order_type)

Sends a position order for the transaction.

Parameters
order_typeThe type of position order.
Returns
The result of sending the order as ENUM_ORDER_TRANSACTION.
+ Here is the call graph for this function:

◆ Update()

void Transaction::Update ( )

Updates the transaction parameters.

+ Here is the caller graph for this function:

Member Data Documentation

◆ priceAsk

double Transaction::priceAsk
protected

◆ priceBid

double Transaction::priceBid
protected

◆ tickSize

double Transaction::tickSize
protected

Ask price, Bid price, and Tick size for the transaction

◆ tradeCheckResult

MqlTradeCheckResult Transaction::tradeCheckResult

Trade check result for the transaction

◆ tradeRequest

MqlTradeRequest Transaction::tradeRequest

Trade request for the transaction

◆ tradeResult

MqlTradeResult Transaction::tradeResult

Trade result for the transaction

◆ typeFilliingMode

ENUM_ORDER_TYPE_FILLING Transaction::typeFilliingMode
protected

Filling mode for the transaction


The documentation for this class was generated from the following file: