Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Managing Profit target during the night.

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

    Managing Profit target during the night.

    I am taking profit during the day by controling the gains between price paid and current price.
    if (current price- proce paid / pricepaid >= x) exitLomg.
    However, as my system dos not run all night long, I want to leave a profit target order open.
    so, at 155900 I use:
    if(ToTime(Times[0][0])==155900)
    {
    if (Position.MarketPosition == MarketPosition.Long)
    {
    myLongProfitTargetOrder = ExitLongLimit(positionTaken,(priceLong*(1+stopGain Number)));
    }
    if (Position.MarketPosition == MarketPosition.Short)
    {
    myShortProfitTargetOrder = ExitShortLimit(positionTaken,(priceShort/(1+stopGainNumber)));
    }
    at 93200 I cancel myLongProfitTargetOrder and myShortProfitTargetOrder .
    But as I am testing the profit target order is not working (at least on backtesting).
    Is this the right way to leave profit target orders during night?

    #2
    Hello,
    That is one process you could use to submit the order.
    You will need to debug the strategy if you are seeing that it is not submitting the order. using TraceOrders to trace what is occurring with the orders. Please see the following link on TraceOrders: http://ninjatrader.com/support/forum...ead.php?t=3627
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      tracing orders I found out that my profit target orders are canlled after some time..

      'So, i am trying to use.
      myLongProfitTargetOrder = ExitLongLimit(0,true,positionTaken,(priceLong*(1+s topGainNumber)));

      but the compiler is not accepting it. saying that ExitShortLimit (int, double, string...)

      Btw, do I have to use ExitShortLimit to order a profit target?

      Comment


        #4
        Hello,
        The closest overload that you are using is the Advanced Order Handling overload for the ExitShortLimit() order method: ExitShortLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName, string fromEntrySignal)

        From the code you have provided you are missing arguments for the signalName string and the fromEntrySignal string. To use this overload you will need to add those arguments.

        The ExitShortLimit() is one way to submit a pending limit order. You could also use the SetProifitTarget() method. Please see the following link on the SetProfitTarget() method: http://ninjatrader.com/support/helpG...ofittarget.htm
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          problem solved. thx..

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          633 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          567 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X