Difference between revisions of "Portfolio SetMaxPotentialLossPerContract"

From MultiCharts
Jump to navigation Jump to search
(Created page with "Redefines the values for the indicated symbol. The values in the $ box if the Absolute Max Potential Loss option is selected or the values in the % box if the [[Max Po...")
 
Line 1: Line 1:
Redefines the values for the indicated symbol. The values in the [[$]] box if the [[Absolute Max Potential Loss]] option is selected or the values in the % box if the [[Max Potential Loss]] is selected.  
+
Redefines the values for the indicated symbol. The values in the '''$''' box if the [[Strategy Properties|Absolute Max Potential Loss]] option is selected or the values in the % box if the [[Strategy Properties|Max Potential Loss]] is selected.  
The newly set value is valid during the strategy calculation or until the [[Portfolio_SetMaxPotentialLossPerContract]] is requested again assigning a new value.  
+
 
 +
The newly set value is valid during the strategy calculation or until the '''Portfolio_SetMaxPotentialLossPerContract''' is assigned a new value.  
 
   
 
   
==== Usage ====
+
== Usage ==
 
<syntaxhighlight>Portfolio_SetMaxPotentialLossPerContract(NewValue);</syntaxhighlight>  
 
<syntaxhighlight>Portfolio_SetMaxPotentialLossPerContract(NewValue);</syntaxhighlight>  
  
==== Parameters  ====  
+
== Parameters  ==
  
[[NewValue]] is a numerical value that can be:  
+
:'''NewValue''' - a numerical value that can be:  
* an absolute value in the range [-100, -0.001]; defines percentage of the maximum potential loss per contract. (Max Potential Loss: %)  
+
::* An absolute value in the range [-100, -0.001]; defines percentage of the maximum potential loss per contract. (Max Potential Loss: %)  
* a value in the range [0.001, 1e+29]; defines the maximum potential loss per contract in dollars. (Absolute Max Potential Loss: $)  
+
::* a value in the range [0.001, 1e+29]; defines the maximum potential loss per contract in dollars. (Absolute Max Potential Loss: $)  
* equal 0; in this case the value entered in the [[Format Settings]] dialog window under the [[Portfolio Settings]] tab is used.  
+
::* equal 0; in this case the value entered in the '''Format Settings''' dialog window under the [[Portfolio Settings]] tab is used.  
  
[[Portfolio_SetMaxPotentialLossPerContract]] returns:  
+
'''Portfolio_SetMaxPotentialLossPerContract''' returns:  
* True if the value is in one of the ranges indicated above. Redefining is considered to be succesfull.  
+
* True if the value is in one of the ranges indicated above. Redefining is considered to be successful.  
* False if the if the value is out of the ranges indicated above. Redefining is considered unsuccessful and the Max Potential Loss value is unchanged.  
+
* False if the if the value is out of the ranges indicated above. Redefining is considered unsuccessful and the '''Max Potential Loss value''' is unchanged.  
 
   
 
   
==== Notes ====  
+
== Notes ==
This function can only be used in signals intended to be used with the Portfolio Backtester.  
+
* This function can only be used in signals intended to be used with the [[:Category:Portfolio_Backtesting|Portfolio Backtester]].
 
   
 
   
==== Example ====
+
== Examples ==
<syntaxhighlight>If "MSFT"=SymbolName then Portfolio_SetMaxPotentialLossPerContract (-10); the new value of -10 is  
+
<syntaxhighlight>If "MSFT" = SymbolName then Portfolio_SetMaxPotentialLossPerContract(-10);</syntaxhighlight>
assigned for the symbol "MSFT" only if such symbol is exist in the portfolio.  
+
The new value of -10 is assigned for the symbol "MSFT" only if such symbol is exist in the portfolio.  
  
Portfolio_SetMaxPotentialLossPerContract (-5); redefines the percentage value of the maximum
+
<syntaxhighlight>Portfolio_SetMaxPotentialLossPerContract(-5);</syntaxhighlight>
potential loss per contract for 5%.  
+
Redefines the percentage value of the maximum potential loss per contract for 5%.  
  
Portfolio_SetMaxPotentialLossPerContract (200); redefines the maximum potential loss per contract
+
<syntaxhighlight>Portfolio_SetMaxPotentialLossPerContract(200);</syntaxhighlight>
for $200.</syntaxhighlight>
+
Redefines the maximum potential loss per contract for $200.
  
 
[[Category:Portfolio Strategy Position]]
 
[[Category:Portfolio Strategy Position]]

Revision as of 14:36, 19 February 2012

Redefines the values for the indicated symbol. The values in the $ box if the Absolute Max Potential Loss option is selected or the values in the % box if the Max Potential Loss is selected.

The newly set value is valid during the strategy calculation or until the Portfolio_SetMaxPotentialLossPerContract is assigned a new value.

Usage

Portfolio_SetMaxPotentialLossPerContract(NewValue);

Parameters

NewValue - a numerical value that can be:
  • An absolute value in the range [-100, -0.001]; defines percentage of the maximum potential loss per contract. (Max Potential Loss: %)
  • a value in the range [0.001, 1e+29]; defines the maximum potential loss per contract in dollars. (Absolute Max Potential Loss: $)
  • equal 0; in this case the value entered in the Format Settings dialog window under the Portfolio Settings tab is used.

Portfolio_SetMaxPotentialLossPerContract returns:

  • True if the value is in one of the ranges indicated above. Redefining is considered to be successful.
  • False if the if the value is out of the ranges indicated above. Redefining is considered unsuccessful and the Max Potential Loss value is unchanged.

Notes

Examples

If "MSFT" = SymbolName then Portfolio_SetMaxPotentialLossPerContract(-10);

The new value of -10 is assigned for the symbol "MSFT" only if such symbol is exist in the portfolio.

Portfolio_SetMaxPotentialLossPerContract(-5);

Redefines the percentage value of the maximum potential loss per contract for 5%.

Portfolio_SetMaxPotentialLossPerContract(200);

Redefines the maximum potential loss per contract for $200.