Library "Position_control" This is a library for defining positions and working with them.
f_calculateLeverage(_Leverage, _maintenance, _value, _direction) Calculate the leverage used in a trade. description This function calculates the leverage used in a trade, based on the value of the trade, the maintenance margin, and the direction of the trade. Parameters: _Leverage (float): The leverage used in the trade, as a floating point number. _maintenance (float): The maintenance margin percentage, as a floating point number. _value (float): The value of the trade, as a floating point number. _direction (string): The direction of the trade, either "long" or "short". Returns: The leverage used in the trade, as a floating point number.
f_calculate_PL(_Position, _max_TP, _Position_index, _show_profit, _i_decimals_contracts, _i_decimals_prercent) Calculate the profit or loss for a given trade. description This function calculates the profit or loss for a given trade, based on the position type, maximum take profit, position index, and whether to show the profit as a percentage or a value. Parameters: _Position (t_Position_type[]): An array of position types for the trade. _max_TP (int): The maximum take profit for the trade, as an integer value. _Position_index (int): The index of the position in the array, as an integer value. _show_profit (bool): A boolean value indicating whether to show the profit as a percentage or a value. _i_decimals_contracts (int) _i_decimals_prercent (int) Returns: The profit or loss for the trade, as a floating point number.
f_drawposition(_Position, _Parameters, _Position_index) draws a position on the chart description via sending in a typo of Position this function is able to drawout Stoploss, Entrybox, Takeprofits and the required labels with information Parameters: _Position (t_Position_type[]): array of type t_Position_type containing the position information. _Parameters (t_drawing_parameters) _Position_index (int): the index of the current position. Returns: None but boxes / lines / labels on the chart itself