Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Emily C.NinjaTrader Customer Service

    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 AaronKoRn, Yesterday, 09:49 PM
      0 responses
      11 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      10 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      11 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,980 views
      3 likes
      Last Post jhudas88  
      Started by rbeckmann05, Yesterday, 06:48 PM
      0 responses
      9 views
      0 likes
      Last Post rbeckmann05  
      Working...
      X