• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Breakeven code

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

    Breakeven code

    if (Close[0] <= Position.AveragePrice - 30 * TickSize)
    ExitShortStopMarket(Position.Quantity, Position.AveragePrice);

    does anyone know what is incorrect on the above code
    Thanks
    Last edited by DTSSTS; 01-19-2020, 12:46 PM.

    #2
    Hello DTSSTS,

    As far as syntax, I would not expect any compile errors if this is in the action block of a method.

    With logic, I could see an issue that there is no check for a position.

    Below is a link to examples of custom exit order movement.
    https://ninjatrader.com/support/foru...269#post802269
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3

      https://gyazo.com/512c4f88faff2944a8e048e8c747ce27

      looking over the SetMethods example

      is the Trailing Stop Trialing by the "Stop Loss distance" ?

      and What is a Chase Profit Target

      Thanks for the examples as well

      Comment


        #4
        Not sure it will matter, i added all the lines of script code in all areas, no compile errors , but now my strategy will not enter any trades

        I do notice on testing that my Start Date i have set to 8/01/2019 But the Actual results are only going back to 1/1/2020


        https://gyazo.com/a4e7089b9a2d369ccd487b527a023664
        Last edited by DTSSTS; 01-20-2020, 06:14 PM.

        Comment


          #5
          Hello DTSSTS,

          Yes, the Stop loss distance represents the number of ticks from entry the stop price will initially set, and also controls the distance from the current price for the trailing action.

          A chase profit target is a limit order that trails toward the current price as the price moves away.
          https://ninjatrader.com/support/help...auto_chase.htm

          Use prints to understand the behavior of your script. Below is a guide that shows what to put in the print.
          https://ninjatrader.com/support/foru...121#post791121

          I am happy to assist with analyzing the output from prints.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by abdullah, 11-15-2017, 08:44 PM
          11 responses
          822 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by brunoviveiros, Today, 04:31 AM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by foxy_rav, Today, 06:31 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by neilzep, Today, 06:42 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by teafortwo, Today, 04:26 AM
          3 responses
          9 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Working...
          X