• 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 dr0832, 01-04-2019, 10:34 AM
      7 responses
      141 views
      0 likes
      Last Post Lancer
      by Lancer
       
      Started by cbentrikin, Today, 07:46 PM
      0 responses
      4 views
      0 likes
      Last Post cbentrikin  
      Started by RedDuke, Today, 06:14 PM
      0 responses
      4 views
      0 likes
      Last Post RedDuke
      by RedDuke
       
      Started by DariusDeck, Today, 04:22 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Marco  
      Started by pstrusi, Today, 05:05 PM
      1 response
      3 views
      0 likes
      Last Post pstrusi
      by pstrusi
       
      Working...
      X