Difference between revisions of "SetStopLoss"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | Closes out the entire position or the entry if the loss reaches the specified currency value; generates the appropriate Stop order depending on whether the position is long or short. | + | Closes out the entire position or the entry if the loss reaches the specified currency value; generates the appropriate [[Stop]] order depending on whether the position is long or short. |
− | [[SetStopPosition]] and [[SetStopContract]] or [[SetStopShare]] functions determine whether the | + | The [[SetStopPosition]] and [[SetStopContract]] or [[SetStopShare]] functions determine whether the '''SetStopLoss''' function will be applied to the entire position or to each contract or share individually; by default, '''SetStopLoss''' is applied to the entire position. |
− | SetStopLoss function is evaluated intra-bar and not only on close of a bar, and can exit within the same bar as the entry. | + | <div style="background-color: #E3FBE5;margin-bottom:10px;">The SetStopLoss function is evaluated intra-bar and not only on close of a bar, and can exit within the same bar as the entry.</div> |
− | + | == Usage == | |
<syntaxhighlight>SetStopLoss(Amount)</syntaxhighlight> | <syntaxhighlight>SetStopLoss(Amount)</syntaxhighlight> | ||
− | Where: | + | Where: |
+ | |||
+ | :'''Amount''' - a numerical expression, specifying the stop loss amount. | ||
− | + | == Notes == | |
− | This function can only be used in signals. | + | * This function can only be used in signals. |
− | == | + | == Examples == |
Generate an exit order for the entire position if the position loss reaches $100: | Generate an exit order for the entire position if the position loss reaches $100: | ||
Line 19: | Line 21: | ||
SetStopLoss(100);</syntaxhighlight> | SetStopLoss(100);</syntaxhighlight> | ||
− | |||
Generate an exit order for the entry if the loss per contract reaches $10: | Generate an exit order for the entry if the loss per contract reaches $10: |
Latest revision as of 16:50, 19 February 2012
Closes out the entire position or the entry if the loss reaches the specified currency value; generates the appropriate Stop order depending on whether the position is long or short.
The SetStopPosition and SetStopContract or SetStopShare functions determine whether the SetStopLoss function will be applied to the entire position or to each contract or share individually; by default, SetStopLoss is applied to the entire position.
The SetStopLoss function is evaluated intra-bar and not only on close of a bar, and can exit within the same bar as the entry.
Usage
SetStopLoss(Amount)
Where:
- Amount - a numerical expression, specifying the stop loss amount.
Notes
- This function can only be used in signals.
Examples
Generate an exit order for the entire position if the position loss reaches $100:
SetStopPosition;
SetStopLoss(100);
Generate an exit order for the entry if the loss per contract reaches $10:
SetStopContract;
SetStopLoss(10);