×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

Changes - MultiCharts

Changes

Jump to navigation Jump to search

Portfolio CalcMaxPotentialLossForEntry

318 bytes added, 18:57, 24 July 2014
no edit summary
Calculates and returns the maximum potential loss (not including margin, commision commission or slippage) if the user entered the position with the number of [[Contracts]] and [[EntryPrice|Priceof entry]] of entry.
==== Usage ====
<syntaxhighlight>Portfolio_CalcMaxPotentialLossForEntry (Side <,Contracts <,Price>>);</syntaxhighlight>
Parameters inside the angled brackets are optional - if these aren't defined, the default is used.
==== Parameters ==== :'''Side''' - a numerical expression specifying the entry type (e.g. 1 Long entry or -1 Short entry).:'''Contracts''' - an optional parameter specifying the number of contracts. ::If the Contracts parameter is not specified then the number of contracts indicated in the [[Portfolio Settings|Format Settings]] dialog window under the '''Properties''' tab is used by default. :'''Price''' - an optional parameter specifying the price value. ::If the Price parameter is not specified, then the [[Close]] price value of the current bar will be used by default. This parameter can be rounded down if entered a Short position or rounded up if entered a Long position.
Side is a numerical expression specifying == Notes ==This function can only be used in signals intended to be used with the entry type (e.g. 1 Long entry or -1 Short entry)Portfolio Trader.
[[Contracts]] The value is an optional parameter specifying returned in the number currency specified in Portfolio Trader: '''Portfolio Settings -> Base Currency.''' == Examples ==<syntaxhighlight>Portfolio_CalcMaxPotentialLossForEntry (0, 25, High)</syntaxhighlight>Will return a value of contracts. If 0, since the Contracts parameter ''Side'' is 0. <syntaxhighlight>Portfolio_CalcMaxPotentialLossForEntry (1, 100, Close)</syntaxhighlight>Will return the maximum potential loss (not specifiedincluding margin, then the number of commission or slippage) if user entered a Long position for 100 contracts indicated in at the [[Format Settings]] dialog window under the [[Properties]] tab is used by defaultClose price.
[[Price]] is an optional parameter specifying the price value. If the Price parameter is not specified, then the Close price value of the current bar will be used by default. This parameter can be rounded down if entered a Short position or rounded up if entered a Long position. ==== Notes ==== This function can only be used in signals intended to be used with the Portfolio Backtester. ==== Example ====<syntaxhighlight>Portfolio_CalcMaxPotentialLossForEntry (0-1, 255, HighOpen) will </syntaxhighlight>Will return the maximum potential loss (not including margin, commission or slippage) if user entered a value of 0, since Short position for 5 contracts at the parameter Side=0 Open price.
<syntaxhighlight>Portfolio_CalcMaxPotentialLossForEntry (1, 100, Close) will </syntaxhighlight>Will return the maximum potential loss (not including margin, commision commission or slippage) if the user entered a Long position for 100 a number of contracts indicated in the Format Settings dialog window under the Properties tab at the Close price.
Portfolio_CalcMaxPotentialLossForEntry (-1, 5, Open) will return the maximum potential loss (not including margin, commision or slippage) if user entered a Short position for 5 contracts at Open price.
Portfolio_CalcMaxPotentialLossForEntry (1) will return the maximum potential loss (not including margin, commision or slippage) if the user entered a Long position for a number of contracts indicated in the Format Settings dialog window under the Properties tab at Close price.</syntaxhighlight>
[[Category:Portfolio Strategy Position]]

Navigation menu