• 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

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 bomanpbm, Today, 09:27 PM
      0 responses
      1 view
      0 likes
      Last Post bomanpbm  
      Started by tgn55, Today, 08:47 AM
      0 responses
      8 views
      0 likes
      Last Post tgn55
      by tgn55
       
      Started by ballboy11, 05-04-2019, 10:26 AM
      6 responses
      58 views
      0 likes
      Last Post Kermit
      by Kermit
       
      Started by mrlucky1x, Yesterday, 10:01 PM
      0 responses
      15 views
      0 likes
      Last Post mrlucky1x  
      Started by roger556, Yesterday, 09:22 PM
      0 responses
      8 views
      0 likes
      Last Post roger556  
      Working...
      X