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

Profit Target Calculation Method

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

    Profit Target Calculation Method

    When using Strategy Builder, if I want to set the target at a point that price action seems to dictate, I need to be able enter that. The options seem to be there but the strategy will not run any time I use a formula.

    For example:
    Let's say I want to set the price to exit the strategy at a distance dictated by the previous two bars such as the high of bar 0 minus the close of bar 1 (or High[0] - Close[1]= profit target)

    So I go to enter that by selecting "Profit Target", enter @signal, select "Price" from the drop down menu, then click "Set";"Price";"High"bar[0]; -; "Set" "Close[1]"; "okay"; "okay"; "okay"

    (I have attached a GIF showing what I mean)

    However, no matter how I run it, it will not run. But if I just simply put a 4 tick target profit, the strategy will run. How do I accomplish what I am trying to accomplish here?

    #2
    I attached a GIF that showed the motions of what I did but when I click on it, It shows a crappy photo. I'm going to attempt to upload differently here.

    Edited: That didn't work. Trying again
    Edited Again: Nope. Sorry. GIF is not coming through.
    Attached Files
    Last edited by smcllr; 02-16-2021, 04:52 PM.

    Comment


      #3
      Hello smcllr,

      Unfortunately, the Strategy Builder is limited and the Stops and Targets cannot use dynamic values. These are set once in State.Configure, and are not updated during the life of the script in OnBarUpdate.

      Because of this dynamic values such as indicator, bar prices, or calculated values, cannot be used for Stops and Targets in the Strategy Builder.


      To submit orders using dynamic prices in the Strategy Builder it would be necessary to use Exit methods in the 'Do the following' > Order Management section.

      Below is a link to an example created with the Strategy Builder.
      https://ninjatrader.com/support/foru...596#post806596

      In an unlocked NinjaScript Strategy, you may call Set methods in OnBarUpdate and use SetStopLoss() dynamically with an indicator or other bar price.

      Below is a link to an example.
      https://ninjatrader.com/support/foru...269#post802269


      Math, is also a limitation. The only math available is with the offsets used with Series such as Close, Open, High, Low series, as well as Indicator series, and custom series added on the Addition Data page of the Strategy Builder in the Custom Series section.

      NinjaTrader_PaulH has a great video demonstrating using custom series to do math with the offsets to add the Realized and Unrealized Pnl together. This same workaround can be used for other basic math.


      Also, below is a link to an example of a daily loss limit in the strategy builder that demonstrates using offsets to do math.
      https://ninjatrader.com/support/foru...ples#post93881
      Last edited by NinjaTrader_ChelseaB; 09-11-2022, 08:18 PM.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Brevo, Today, 01:45 AM
      0 responses
      6 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      242 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      6 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Working...
      X