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

Determining the InstrumentType in order to set IsExitOnSessionCloseStrategy

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

    Determining the InstrumentType in order to set IsExitOnSessionCloseStrategy

    how can I write this code correctly?

    it works... but the help documentation makes me a bit worried about it.


    else if (State == State.Configure) {
    IsExitOnSessionCloseStrategy = Instrument.MasterInstrument.InstrumentType == InstrumentType.Future;

    }

    I want to disable IsExitOnSessionCloseStrategy for Forex or CFDs but leave it enabled for Futures

    HELP:

    IsExitOnSessionCloseStrategy

    Warnings:

    •This property should ONLY bet set from the OnStateChange() method during State.SetDefaults or State.Configure

    Instrument
    Warning: The properties in this class should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded


    #2
    Hello NinjaCustomer,

    Thank you for the post.

    You are correct to be worried here, the note is warning that this property may not be populated before DataLoaded so what you are trying may not work in all use scenarios.

    While you can use this if it works for what you are doing if you find this does not work in one of the tools you would likely need to just use the standard option in the user interface to turn this on or off manually.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      and I guess that setting IsExitOnSessionCloseStrategy in OnDataLoaded is not an option?

      Comment


        #4
        Hello NinjaCustomer,

        That is not specifically suggested no, you can certainly try that and see what the result is for you however that would not be the general help guide suggestion. This property only mentions it is best set from SetDefaults or Configure, there is currently no documented expectation past those points.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        3 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        7 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X