Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder Exit by opposite Direction Entry Signals

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

    Strategy Builder Exit by opposite Direction Entry Signals

    Hi,

    I build a strategy using Strategy builder without Fixed Stop Loss or Take Profit. For a Long Entry I intend for the Strategy to exit when a Short signal criteria is met. And at the same time makes a New Short Position. What i notice is that sometimes it works as intended and sometimes the strategy did not close and reenter when the opposite signal occurs?

    What could be the reason for that?

    Thank you

    CW

    #2
    Hello kevtancw,

    Thank you for your post.

    To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.

    The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

    The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

    After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.

    I am happy to assist you with analyzing the output from the output window.

    Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

    Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

    https://support.ninjatrader.com/s/ar...nd-TraceOrders

    Comment


      #3
      Hi Gaby,

      I use the color bar function. When my conditions are met the bar will be colored. Please see attached.

      I have set the conditions where a Long Stop Entry order shall be placed at the High of the Cyan Colored Bar.

      In Picture A, the Strategy is working fine. The 1st Entry FSShort A is executed and followed by a Close of the position when FSLong B signal is executed and a new Long order is created.

      In Picture B, the Strategy is not working as intended. After 1st Entry FSShort A&B was executed, there is no order executed at a valid signal. I indicate the valid signal with the Pink Arrow.

      Any idea what could be the reason?

      Thank you
      CW
      Attached Files

      Comment


        #4
        Hello,

        We will need the output in order to determine what could be the reason. I look forward to receiving the debugging output.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        69 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        42 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        24 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        27 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        54 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X