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

Another auto breakeven question

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

    Another auto breakeven question

    Ok guys and gals I have spent hours trying to figure this out so I didn't have to come on here and ask what I know is going to be a very simple answer for some of you on here but I cant figure it out. Just for test purposes I have took the BreakEvenBuilderTemplate that Chelsea posted in post number 2 on the following post Forum Request Breakeven Functions in Strategy Builder - NinjaTrader Support Forum I added a very simple crossover strategy to it just to wrap my head around how to do this using the strategy builder. I have the Auto BreakEven and Stop working fine using the Condtions and Actions tabs. Heres what I cant figure out: How to I get my position to exit at my Target price??? I have tried what feels like everything and just cant get it to work. I'm attaching photos of my current strategy that again the trigger for breakeven and the stop loss works perfectly. I just cant figure out how to exit at a target. Example 12 ticks in the profit.

    I hope someone can advise me how to change what I have done to make this work. Thanks in advance.


    #2
    Hello XxJamesAxX,

    Thanks for your post.

    The ExitLongLimit() method being called in your script would place the profit target order on the chart. In the screenshots you shared I see that you are setting the ExitLongLimit() order to be placed at the AveragePrice of the position + TargetPrice (12) in ticks. This would be the correct way to place the profit target order 12 ticks above the average price of the entry order.

    When you mention the profit target order is not working, what exactly do you mean?

    Do you see any error messages appear in the Log tab of the Control Center?

    Is the profit target order not being placed on the chart?

    Does the current market price not reach the profit target order level to exit the position?

    Note that the profit target order will only exit the position if the current market price reaches that profit target order level.

    I have attached a simple example script created with the Strategy Builder demonstrating how to use ExitLongLimit() to place a profit target order 12 ticks above the average price of the entry order.

    Please let me know if I may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      I’m posting away from my computer I can provide more information when I get back home but what I mean is when price reaches my target it does not exit the trade. I have not tested this strategy in real time only in the strategy analyzer.

      However everything else seems to work fine, example I enter a long trade and price starts to rise, my stop loss is placed, then after X number of ticks of the price rising it moves my stop to break even, however no matter how high the price goes it will not exit the trade until price comes back to my breakeven point.

      I can provide further screenshots when I get home and check the log.

      Any thoughts?
      Last edited by XxJamesAxX; 12-13-2022, 04:31 PM.

      Comment


        #4
        Quick update I think I may have it fixed, I'm going to run it today live on a sim account just to make sure, it appears to be working in the strategy analyzer now other than its executing everything at the bar close instead of at the touch of my target. Which I assume is normal for the way the strategy analyzer works so I'm going to run it live to verify its functioning. I'll report back at the end of the day.
        Last edited by XxJamesAxX; 12-14-2022, 08:14 AM.

        Comment


          #5
          Hello XxJamesAxX,

          Thanks for your note.

          I am happy to hear you might have fixed the issue.

          "its executing everything at the bar close instead of at the touch of my target. Which I assume is normal for the way the strategy analyzer works"

          That is correct, the Strategy Analyzer will only process logic and place trades OnBarClose.

          Please review the help guide document on the differences on real-time vs backtest (historical).
          http://ninjatrader.com/support/helpG...ime_vs_bac.htm

          When in historical data (backtesting), only the Open, High, Low, and Close will be available and there will be no intra-bar data. This means actions cannot happen intra-bar, fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the information that is known.

          Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick' and the script will not have the intra-bar information to accurately fill an order at the exact price and time.

          Below is a link to the help guide on Calculate.
          https://ninjatrader.com/support/help.../calculate.htm

          Let me know if I may provide further assistance.​
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by strategist007, Today, 07:51 PM
          0 responses
          1 view
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,967 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          4 views
          0 likes
          Last Post rbeckmann05  
          Started by rhyminkevin, Today, 04:58 PM
          4 responses
          55 views
          0 likes
          Last Post dp8282
          by dp8282
           
          Started by iceman2018, Today, 05:07 PM
          0 responses
          6 views
          0 likes
          Last Post iceman2018  
          Working...
          X