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

Why strategy analyzer close all positions in the day

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

    Why strategy analyzer close all positions in the day

    I'm running strategy analyzer on day timeframe, but all position open are close at the end of day.
    I set:


    Name = "Strategia1";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = false;
    // ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;


    thank you for help

    #2
    Hello enzoo,

    Thank you for your note.

    If you change,

    Code:
    IsExitOnSessionCloseStrategy	= false;
    //	ExitOnSessionCloseSeconds	= 30;
    To,

    Code:
    IsExitOnSessionCloseStrategy	= true;
    ExitOnSessionCloseSeconds	= 30;
    Does the strategy exit as expected?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      thank you for so fast reply.
      I applyed the proposed changing but the result is the same.

      I don't want the positions are closed at the end of the same day, seewhat is happening in annex

      i would like to open long position that last for days and after open a short position that close previous long position and open one in short,

      instead now all open positions are automatically close at the end of the same day.
      Attached Files

      Comment


        #4
        Hello enzoo,

        It looks like your trades are closing out rather quickly due to having a tight profit target. For example it looks like your profit target is closing your positions for 15 cents profit on a stock trading almost 1000.

        I would suggest using a wider profit target and you're positions should remain open as long as those targets or stops are not breached.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          thank you now it is working.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Gerik, Today, 09:40 AM
          2 responses
          6 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Started by RookieTrader, Today, 09:37 AM
          2 responses
          10 views
          0 likes
          Last Post RookieTrader  
          Started by alifarahani, Today, 09:40 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by KennyK, 05-29-2017, 02:02 AM
          3 responses
          1,285 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by AttiM, 02-14-2024, 05:20 PM
          11 responses
          186 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X