Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order handling issue, Help Please

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

    Order handling issue, Help Please

    So Ive been working on a strategy and it seems to be taking trades in undesirable locations.

    I want to only enter shorts above the upper MA bands, yet its taking shorts when the price is near the lower bands. Any suggestions? It seems to think its in a long when its not and doesn't flatten, but rather takes a short



    for context, Set 1 is for long entry, Set 2 is exiting Longs, and Set 4 is for exiting shorts MNQ6mA, and MNQ6mB are copies of one another, just set at different band settings.

    Attached Files
    Last edited by Conceptzx; 09-02-2023, 06:44 PM.

    #2
    Hello Conceptzx,

    Thanks for your post.

    Note that running multiple NinjaScript strategies on the same account and same instrument means that the orders placed by 1 strategy could affect how the other strategy places orders.

    See this forum thread for detailed information about running multiple NinjaScript strategies on the same account / instrument combination:
    https://ninjatrader.com/support/foru...tures-contract

    I suggest that you test one strategy at a time to ensure that the strategy is placing orders as expected without the second strategy instance interfering with orders being placed.

    Note that Entry() methods will reverse the position automatically when they are calling in the opposite direction. For example if you are in a 1 contract long position and now call EnterShort() -> you will see 2 executions, one to close the prior long position and the other to get you into the desired 1 contract short position.

    Managed Approach: https://ninjatrader.com/support/help...d_approach.htm

    That said, if the strategy is not behaving as expected sometimes then debugging steps should be taken.

    To understand why the script is behaving as it is, such as placing orders or not placing orders 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 values of every variable used in every condition that places an order along with the time of that bar. Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121​​
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      I'm working on building the into a single strategy now. Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X