Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder: different Target and Stop depending on the size of the candle[0]

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

    Strategy Builder: different Target and Stop depending on the size of the candle[0]

    Hello!
    I kindly need help with the following:

    I am developing a strategy in the "Strategy Builder" that goes long every time certain conditions are met and goes short every time certain (different from long) conditions are met.
    Now, I want to create two different sets of ProfitTarget and StopLoss per entry depending on the size of the candle[0].

    For example, if all the conditions are met, I want to submit an Enter limit/stop order for either long/short, and right after it gets filled, submit one of the two Target and Stop combinations:
    - If a candle size of [0] is between 40-120 ticks: submit a 40 ticks Target and Stop
    - If a candle size of [0] is between 0-39 ticks: submit a 20 ticks Target and Stop.

    I am able to set the conditions and place a limit order to enter; however, once it gets filled, the ProfitTarget and StopLoss are STATIC and won't change depending on the size of the candle. The only Profit and Stop placed is 40-40 ticks

    Things to consider:
    - I want to be ONLY in 1 position at a time
    - Once submitted the limit order to enter either long or short, I want to cancel the order if it hasn't been filled when the current bar closes (which for me is currently working correctly)

    Thank you for your help!
    I appreciate it

    #2
    Hello francescoconolombardi,

    To do what you are asking you would need to avoid using the stops and targets page of the builder. You would have to submit the orders from the condition sets instead. You can find a sample that does a break even in the following link, that would essentially be the same concept that you are asking for. After the entry is filled you would use logic to submit the order and hold the order open until filled. https://ninjatrader.com/support/foru...rategy-builder

    - I want to be ONLY in 1 position at a time
    you would need to check the strategy position as part of your entry condition, that would prevent entering again if you are in a position.

    Comment


      #3
      Thank you Jesse!

      That's exactly what I have (EnterLong & Enter Short / ExitLong & ExitShort).
      It's working, but partially.

      - What is working: The tick size of the stops and targets depending on the size of the previous candle are placed accordingly.

      - What is NOT working: Stops and Targets are placed when the candle that the order was placed closes (which is not what I want)
      Let me further explain:
      I want to place the Target and Stop losses right after the EnterLong or EnterShort orders are filled.
      However, this strategy (as I have it right now) places the targets and stops after the entry candle closes.
      This means that I am 15min (time of candle) unprotected without target and stop (until the new candle opens)

      See attachments below

      How do I change the timing of the ExitLong /ExitShort orders? I want to place the orders as Enter order is FILLED.
      Thank you Jesse!

      Comment


        #4
        Hello francescoconolombardi,

        Thank you for the question.

        What you are asking to do would require using OnEachTick calculation. If you needed to still work with OnBarClose for some logic you would have to simulate that by checking if the CurrentBar changes. You can find a sample of that concept here: https://ninjatrader.com/support/foru...13#post1116713

        In future version of the platform you could instead go to Misc -> isFirstTickOfBar when that becomes available to use.

        Once the target fills the position will update, at the tick frequency that will allow the targets to be submitted nearly at the time of the fill.


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        51 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        127 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