Available translations

Profit Loss

foundations.png
profit-loss.png
Profit loss is the difference between the balance at the end and the balance at the beginning of a certain period, given by the context.
Content
In the context of the base asset or the quoted asset, the calculation is done by subtracting the balances in the corresponding assets, using the variable appropriate to the larger context (i.e.: episode, position, etc.).
In general terms:
 base asset profit loss = base asset end balance - base asset begin balance
 quoted asset profit loss = quoted asset end balance - quoted asset begin balance
In the case of the Episode Base Asset and Episode Quoted Asset:
 tradingEngine.tradingCurrent.tradingEpisode.episodeBaseAsset.profitLoss.value =
    tradingEngine.tradingCurrent.tradingEpisode.episodeBaseAsset.balance.value -
    sessionParameters.sessionBaseAsset.config.initialBalance
    
tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.profitLoss.value =
    tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value -
    sessionParameters.sessionQuotedAsset.config.initialBalance
In the case of the Position Base Asset and Position Quoted Asset:
 tradingEngine.tradingCurrent.position.positionBaseAsset.profitLoss.value =
    tradingEngine.tradingCurrent.tradingEpisode.episodeBaseAsset.balance.value -
    tradingEngine.tradingCurrent.position.positionBaseAsset.beginBalance
    
tradingEngine.tradingCurrent.position.positionQuotedAsset.profitLoss.value =
    tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value -
    tradingEngine.tradingCurrent.position.positionQuotedAsset.beginBalance
In the context of the episode statistics or the position statistics, the calculation is done consolidating the profits of both assets.
In the context of the episode statistics:
 tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeStatistics.profitLoss.value =
    tradingEngine.tradingCurrent.tradingEpisode.episodeBaseAsset.profitLoss.value * 
    tradingEngine.tradingCurrent.tradingEpisode.candle.close.value +
    tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.profitLoss.value
In the context of the position statistics:
 tradingEngine.tradingCurrent.position.positionStatistics.profitLoss.value =
    tradingEngine.tradingCurrent.tradingEpisode.episodeBaseAsset.profitLoss.value * 
    tradingEngine.tradingCurrent.position.endRate.value +
    tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.profitLoss.value
Configuring
Profit Loss Configuration
Properties
  • initialValue allows resetting the initial state of the node to an arbitrary value.
Initial Values
These are the Initial Values for Profit Loss configuration:
 {
    "initialValue": 0
}
Examples
This is a list of properties featured by the Profit Loss configuration. Expanding a property shows sample values for the property extracted from the current Workspace.
Profit Loss Menu
The Profit Loss node has the following Node Menu items:
The Configure menu item has the following properties:
  • action: Configure
  • label: Configure
  • iconPathOn: configuration
  • iconPathOff: configuration
  • actionFunction: uiObject.configEditor.activate
The Copy Node Path menu item has the following properties:
  • action: Copy Node Path
  • label: Copy Node Path
  • iconPathOn: copy-path
  • iconPathOff: copy-path
  • actionFunction: payload.executeAction
  • actionProject: Visual-Scripting
The Copy Node Value menu item has the following properties:
  • action: Copy Node Value
  • label: Copy Node Value
  • iconPathOn: copy-value
  • iconPathOff: copy-value
  • actionFunction: payload.executeAction
  • actionProject: Visual-Scripting
The Copy Node Type menu item has the following properties:
  • action: Copy Node Type
  • label: Copy Node Type
  • iconPathOn: copy-type
  • iconPathOff: copy-type
  • actionFunction: payload.executeAction
  • actionProject: Visual-Scripting
The Delete menu item has the following properties:
  • action: Delete UI Object
  • actionProject: Visual-Scripting
  • askConfirmation: true
  • confirmationLabel: Confirm to Delete
  • label: Delete
  • iconPathOn: delete-entity
  • iconPathOff: delete-entity
  • actionFunction: payload.executeAction
Profit Loss Attaching Rules
The following are the Node Attaching Rules that govern the attachment of Profit Loss with other nodes:
Compatible Types: