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


Set TriggerPrice / Set TriggerState

  • Filter
  • Time
  • Show
Clear All
new posts

    Set TriggerPrice / Set TriggerState


    can somebody direct me to where I can find information on Set TriggerPrice and Set TriggerStop

    I am working with a break even stop from this forum see link below

    It uses the strategy builder with those functions but I cannot find any documentation explaining the parameters or how exactly they are used.

    Thank you


    Hello sdauteil,

    Thank you for your post.

    Are you referring to the BreakEvenBuilderExample?

    TriggerState, TriggerPrice, and StopPrice in that example are simply variables that are manipulated by the strategy.

    Here's where those variables are initialized in the Strategy Builder:

    Click image for larger version

Name:	2019-06-14_1254.png
Views:	87
Size:	78.0 KB
ID:	1060814

    And then they are used as parts of conditions and values for them are updated here in the conditions and actions, for example here:

    Click image for larger version

Name:	2019-06-14_1257_001.png
Views:	96
Size:	88.8 KB
ID:	1060815

    As we can see, these variables are set as the Average Position Price, + the number of ticks specified by the InitialStopDistance and BreakEvenTrigger user inputs.

    Thanks in advance; I look forward to assisting you further.

    Kate W.NinjaTrader Customer Service


      Thank you for the help

      I am trying to figure out the function of the Set TriggerPrice and Set TriggerState that is under the Misc box that comes up when you edit the TriggerPrice line in the action box.

      I looked at the code and I couldn't find this function nor could I find it in the help files.

      Click image for larger version

Name:	Set Trigger Price.JPG
Views:	94
Size:	102.4 KB
ID:	1060862


        Hello sdauteil,

        Thank you for your post.

        "Set TriggerPrice" in the Misc box basically means "TriggerPrice =" whatever value you choose for that box. It is used to reassign the value of that variable to whatever you choose.

        In the case of your screenshot, it's currently being reset to the Current Average Position Price plus the number of ticks away from breakeven you wish multiplied by the ticksize, which is the dollar amount of each tick.

        Please let us know if we may be of further assistance to you.

        Kate W.NinjaTrader Customer Service


          One more question

          If I use the set profit target feature in the strategy builder (1st picture) the break even function will no longer trigger.

          The Break even function does work If I set the profit target in the action window (2nd picture) but if the profit target is hit the position doesn't close until the candle in which the profit target was hit closes.

          Basically I would like the closing order when the profit target is hit to fill immediately. I tried market if touched but that didn't seem to work either.

          I appreciate the help...

          Click image for larger version

Name:	Profit Target.JPG
Views:	75
Size:	63.3 KB
ID:	1061040Click image for larger version

Name:	Strategy Target.JPG
Views:	70
Size:	81.6 KB
ID:	1061041


            Hello sdauteuil,

            Thank you for your reply.

            You would not be able to use the Stops and Targets screen to set a stop loss that would move to breakeven. You would have to use logic in a similar fashion as the example to create a breakeven using Exit methods.

            What is your strategy set to calculate on? OnBarClose will cause your exit orders to be executed after the current bar closes. To have these orders trigger intrabar, you need to set the calculation mode to OnPriceChange (recommended) or OnEachTick (uses more PC resources).

            Here's a link to our help guide that goes over the associated screen in the Strategy Builder:

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service


            Latest Posts


            Topics Statistics Last Post
            Started by PrQuantumH, Today, 04:20 AM
            0 responses
            1 view
            Last Post PrQuantumH  
            Started by guillembm, Today, 12:37 AM
            4 responses
            Last Post guillembm  
            Started by percy3687, Yesterday, 07:45 PM
            1 response
            Last Post NinjaTrader_Jason  
            Started by WHICKED, Yesterday, 08:24 PM
            0 responses
            Last Post WHICKED
            by WHICKED
            Started by trader3000a, Yesterday, 05:32 PM
            0 responses
            Last Post trader3000a