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

Exit on session close

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

    Exit on session close

    hi

    Is there a way to access exit on session close command using logic? I'd like to be able to use it as a bool and optimize to see if exit on session close is beneficial for my strategy or if it is not.

    Or will I have to create a logic and define exit times for each session and exiting my positions during those times? problem is, different instruments have different sessions and closing times so it would be nice to be able to access exit on session close via logic.

    i tried the below but it compiled but did not work.

    Code:
    			if (State == State.SetDefaults)
    			{
    				Description									= @"Opposite of SlopReg2";
    				Name										= "MissionImpossibleTester2";
    				T					= 8;
    				Entry				= 0.0003;
    				EntryS				= 0.0005;
    				ST					= 110;
    				Target1				= 40;
    				Target2				= 70;
    				Target3				= 90;
    				EODClose			= true;
    				Calculate									= Calculate.OnBarClose;
    				EntriesPerDirection							= 1;
    				EntryHandling								= EntryHandling.UniqueEntries;
    				if(EODClose==true)
    				{
    				IsExitOnSessionCloseStrategy				= true;
    				}
    				else if(EODClose==false)
    				{
    				IsExitOnSessionCloseStrategy				= false;
    				}
    thanks
    Last edited by staycool3_a; 01-15-2018, 07:00 PM.

    #2
    Hello calhawk01,

    Thanks for opening the thread.

    State.SetDefaults would be used to populate the property grid with default values. IsExitOnSessionCloseStrategy can be set in State.Configure as well as State.SetDefaults. I was able to set IsExitOnSessionCloseStrategy in State.Configure using a user defined bool and I did not have issue using this in an optimization. Could you let us know if you see any issues setting this in State.Configure?

    I've included documentation links on the NinjaScript Lifecycle and IsExitOnSessionCloseStrategy for anyone that would like to read further.

    IsExitOnSessionCloseStrategy - https://ninjatrader.com/support/help...sestrategy.htm

    NinjaScript LifeCycle - https://ninjatrader.com/support/help...fecycle_of.htm
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello calhawk01,

      Thanks for opening the thread.

      State.SetDefaults would be used to populate the property grid with default values. IsExitOnSessionCloseStrategy can be set in State.Configure as well as State.SetDefaults. I was able to set IsExitOnSessionCloseStrategy in State.Configure using a user defined bool and I did not have issue using this in an optimization. Could you let us know if you see any issues setting this in State.Configure?

      I've included documentation links on the NinjaScript Lifecycle and IsExitOnSessionCloseStrategy for anyone that would like to read further.

      IsExitOnSessionCloseStrategy - https://ninjatrader.com/support/help...sestrategy.htm

      NinjaScript LifeCycle - https://ninjatrader.com/support/help...fecycle_of.htm
      Thanks Jim. That works and It makes sense.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by funk10101, Today, 09:43 PM
      0 responses
      6 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      44 views
      0 likes
      Last Post bill2023  
      Started by yertle, Today, 08:38 AM
      6 responses
      26 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      24 views
      0 likes
      Last Post algospoke  
      Working...
      X