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

Class to calculate stop loss and take profit prices. More...

Public Member Functions

 CalcStop ()
 Default constructor for CalcStop.
 
void SetSymbol (string &symbol_arg)
 Sets the symbol for stop calculation.
 
double Run (double price, long stop, ENUM_POSITION_TYPE type, ENUM_STOP_TYPE stop_type)
 Calculates the stop price based on provided parameters.
 

Static Public Member Functions

static bool VerifyNoNegative (double price)
 Verifies that a single price is not negative.
 
static bool VerifyNoNegative (double &prices[])
 Verifies that all prices in an array are not negative.
 
static bool VerifyNoNegative (CArrayDouble &prices)
 Verifies that all prices in a CArrayDouble are not negative.
 

Public Attributes

string symbol
 Symbol of the asset for which stops are calculated.
 

Protected Types

enum  ENUM_STOP_TYPE { TAKE_PROFIT , STOP_LOSS }
 Enumeration to specify the type of stop (Take Profit or Stop Loss). More...
 

Protected Member Functions

double internal (double price, ulong stop, ENUM_POSITION_TYPE type, ENUM_STOP_TYPE stop_type)
 Internal function to calculate stop loss or take profit prices.
 

Detailed Description

Class to calculate stop loss and take profit prices.

Member Enumeration Documentation

◆ ENUM_STOP_TYPE

enum CalcStop::ENUM_STOP_TYPE
protected

Enumeration to specify the type of stop (Take Profit or Stop Loss).

Enumerator
TAKE_PROFIT 

Take profit type.

STOP_LOSS 

Stop loss type.

Constructor & Destructor Documentation

◆ CalcStop()

CalcStop::CalcStop ( )
inline

Default constructor for CalcStop.

Member Function Documentation

◆ internal()

double CalcStop::internal ( double price,
ulong stop,
ENUM_POSITION_TYPE type,
ENUM_STOP_TYPE stop_type )
protected

Internal function to calculate stop loss or take profit prices.

Parameters
priceBase price.
stopDistance of the stop in points.
typePosition type (buy/sell).
stop_typeType of stop (Take Profit or Stop Loss).
Returns
Calculated stop price.
+ Here is the caller graph for this function:

◆ Run()

double CalcStop::Run ( double price,
long stop,
ENUM_POSITION_TYPE type,
ENUM_STOP_TYPE stop_type )

Calculates the stop price based on provided parameters.

Parameters
priceBase price.
stopDistance of the stop in points.
typePosition type (buy/sell).
stop_typeType of stop (Take Profit or Stop Loss).
Returns
Calculated stop price.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetSymbol()

void CalcStop::SetSymbol ( string & symbol_arg)
inline

Sets the symbol for stop calculation.

Parameters
symbol_argThe symbol to set.
+ Here is the caller graph for this function:

◆ VerifyNoNegative() [1/3]

bool CalcStop::VerifyNoNegative ( CArrayDouble & prices)
static

Verifies that all prices in a CArrayDouble are not negative.

Parameters
pricesArray of prices to check.
Returns
True if all prices are non-negative, false otherwise.

◆ VerifyNoNegative() [2/3]

bool CalcStop::VerifyNoNegative ( double & prices[])
static

Verifies that all prices in an array are not negative.

Parameters
pricesArray of prices to check.
Returns
True if all prices are non-negative, false otherwise.

◆ VerifyNoNegative() [3/3]

bool CalcStop::VerifyNoNegative ( double price)
static

Verifies that a single price is not negative.

Parameters
priceThe price to check.
Returns
True if the price is non-negative, false otherwise.
+ Here is the caller graph for this function:

Member Data Documentation

◆ symbol

string CalcStop::symbol

Symbol of the asset for which stops are calculated.


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