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

Class to handle profit protection mechanisms such as trailing stops and break-even adjustments. More...

+ Inheritance diagram for ProfitProtection:
+ Collaboration diagram for ProfitProtection:

Public Types

enum  ENUM_PROFIT_PROTECTION_TYPE { TRAILING_STOP , BREAK_EVEN }
 Enumeration of different profit protection types. More...
 

Public Member Functions

 ProfitProtection (void)
 Default constructor for the ProfitProtection class.
 
void UpdateAtr (ulong magic_arg, string symbol_arg, double activation_percent_arg, double deviation_percent_arg)
 Updates the attributes of the ProfitProtection class.
 
bool ModifyStopLossFromPositionBuy (ulong ticket, double newStopLoss)
 Modifies the stop loss for a buy position.
 
bool ModifyStopLossFromPositionSell (ulong ticket, double newStopLoss)
 Modifies the stop loss for a sell position.
 
double GetActivationPrice (ulong positionTicket)
 Calculates the activation price for a given position based on the activation percentage.
 

Public Attributes

double activationPercent
 Activation percentage for profit protection.
 
double deviationPercent
 Deviation percentage for profit protection.
 
ulong magic
 Magic number for trade operations.
 
string symbol
 Trading symbol.
 
CTrade trade
 Trade object for performing trade operations.
 
DetectPositions detectPositions
 Object for detecting positions.
 

Detailed Description

Class to handle profit protection mechanisms such as trailing stops and break-even adjustments.

Member Enumeration Documentation

◆ ENUM_PROFIT_PROTECTION_TYPE

Enumeration of different profit protection types.

Enumerator
BREAK_EVEN 

Trailing Stop.

Break Even

Constructor & Destructor Documentation

◆ ProfitProtection()

ProfitProtection::ProfitProtection ( void )
inline

Default constructor for the ProfitProtection class.

Member Function Documentation

◆ GetActivationPrice()

double ProfitProtection::GetActivationPrice ( ulong positionTicket)

Calculates the activation price for a given position based on the activation percentage.

Parameters
positionTicketPosition ticket number
Returns
The activation price for the position, or 0 if the position cannot be selected
+ Here is the caller graph for this function:

◆ ModifyStopLossFromPositionBuy()

bool ProfitProtection::ModifyStopLossFromPositionBuy ( ulong ticket,
double newStopLoss )

Modifies the stop loss for a buy position.

Parameters
ticketPosition ticket number
newStopLossNew stop loss value
Returns
True if stop loss was successfully modified, otherwise false
+ Here is the caller graph for this function:

◆ ModifyStopLossFromPositionSell()

bool ProfitProtection::ModifyStopLossFromPositionSell ( ulong ticket,
double newStopLoss )

Modifies the stop loss for a sell position.

Parameters
ticketPosition ticket number
newStopLossNew stop loss value
Returns
True if stop loss was successfully modified, otherwise false
+ Here is the caller graph for this function:

◆ UpdateAtr()

void ProfitProtection::UpdateAtr ( ulong magic_arg,
string symbol_arg,
double activation_percent_arg,
double deviation_percent_arg )

Updates the attributes of the ProfitProtection class.

Parameters
magic_argMagic number for trade operations
symbol_argTrading symbol
activation_percent_argActivation percentage for profit protection
deviation_percent_argDeviation percentage for profit protection
Parameters
magic_argMagic number argument
symbol_argSymbol argument
activation_percent_argActivation percentage argument
deviation_percent_argDeviation percentage argument
+ Here is the call graph for this function:

Member Data Documentation

◆ activationPercent

double ProfitProtection::activationPercent

Activation percentage for profit protection.

◆ detectPositions

DetectPositions ProfitProtection::detectPositions

Object for detecting positions.

◆ deviationPercent

double ProfitProtection::deviationPercent

Deviation percentage for profit protection.

◆ magic

ulong ProfitProtection::magic

Magic number for trade operations.

◆ symbol

string ProfitProtection::symbol

Trading symbol.

◆ trade

CTrade ProfitProtection::trade

Trade object for performing trade operations.


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