Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Empty string for "fromEntrySignal" param of "Set" Money Mgmnt method overload OK?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Empty string for "fromEntrySignal" param of "Set" Money Mgmnt method overload OK?

    Hi,

    I've carefully read the "Set" money management functions' help pages. All four of these help pages have the following sentence at the end of the description for the "fromEntrySignal" input parameter:

    "Using an empty string will attach the exit order to all entries."

    I would like to standardize my code to always use the method overloads with the most parameters because they offer more advanced options. I would like to use these "maximum number of parameters" method overloads even when I want to use SetStopLoss(), SetTrailStop(), SetProfitTarget(), or SetParabolicStop() to manage the "Total Position" as it is referred to in the NinjaTrader Strategy Builder's user interface, not just manage a position that has a specific "fromEntrySignal" value.

    I noticed that in the NinjaTrader Strategy Builder's "Stops and Targets" tab, if the user selects "Parabolic stop total position", "Profit target total position", or "Stop loss total position", the NinjaScript output uses the method overloads with the smallest number of parameters that doesn't accept an "fromEntrySignal" instead of those with the largest number of parameters and then using the empty string for the value passed to the "fromEntrySignal" parameter as I would like to do in my code.

    Since the NinjaTrader Strategy Builder's "Stops and Targets" tab does it this way (i.e. it uses the method overloads with less parameters and doesn't pass "" for the "fromEntrySignal" parameter) for the 3 "total position" options I figure there might be a problem with doing it the way that I would like to do it to manage the "Total Position", namely by using "" for the "fromEntrySignal" parameter of the method overloads with the larger number of parameters.

    To use "SetStopLoss()" as an example, is there any possible difference whatsoever in for instance 1) calling SetStopLoss using the method overload with the least number of parameters (2 parameters) or 2) calling the SetStopLoss method overload with the most number of parameters (4 parameters) but passing the empty string, i.e. "", as the fromEntrySignal parameter and passing "false" as the "isSimulatedStop" parameter?

    When the help guide says in reference to the "fromEntrySignal" parameter of the method overloads that "Using an empty string will attach the exit order to all entries" is this 100% equivalent to saying that using an empty string will manage the "Total Position" as is done by the method overloads that take less parameters and do not have an "fromEntrySignal" parameter?

    Thank you in advance!

    EquityTrader

    #2
    Hello EquityTrader,

    Thank you for your post.

    Using SetStopLoss() as an example, the following syntax is available:
    Code:
    SetStopLoss(CalculationMode mode, double value)
    SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool isSimulatedStop)

    Calling SetStopLoss(CalculationMode mode, double value) allows you to define the mode and the value. This would apply to the total position, just as you have observed when selecting 'Stop loss total position' in the Strategy Builder. If you choose to use the syntax with additional parameters, you are correct that leaving the fromEntrySignal as an empty string "" and setting isSimulatedStop to false would behave in the same way and apply the stop loss to the total position. Here are examples using both types of syntax to set a stop loss at 15 ticks that would apply to the total position:Hopefully this helps to clarify. Please let us know if we may be of further assistance.

    Comment


      #3
      Hi Emily C.,

      Thank you very much for this excellent information. It is just what I wanted to know.

      EquityTrader

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      50 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X