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

Time Comparisons - Trade Exit

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

    Time Comparisons - Trade Exit

    Hi,

    When I build a strategy and add a Begin time using:

    ToTime(Time[0]) > (ToTime(Time(3,0,0)

    it works fine but when I add an exit time to the Strategy it seems to go unnoticed and the Strategy will continue onward.

    For example the End time that I have been using is:

    ToTime(Time[0]) < ToTime(7,8,0)

    I have also gone into the code and edited the End time to read:

    ToTime(Time[0]) < ToTime(10,10,00))

    Therefore how I do create an End time that works and also how do I go back using the Strategy wizard once I click on "unlock code" and manually compile the code?

    Thank you,

    #2
    Scarlett,

    Unfortunately there is no way to go back to the strategy wizard once you unlock the code. You can however continue to use the condition builder.

    Here is a tutorial : http://www.youtube.com/watch?v=JZpo01eSO9c

    As far as your question, a proper time filter would look something like this.

    Code:
                      if (ToTime(Time[0]) >= ToTime(8, 30, 00)
                    && ToTime(Time[0]) <= ToTime(16, 0, 0))
                   {
                   }
    This would be checking to make sure the time is between 8:30 AM and 4:00 PM
    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by z679Gju, 05-03-2024, 02:37 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by ExtremelyRough, Yesterday, 03:50 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by fingers, 12-15-2023, 08:44 AM
    7 responses
    145 views
    0 likes
    Last Post notenufftime  
    Started by trgui7883, 09-13-2023, 03:32 PM
    2 responses
    165 views
    0 likes
    Last Post Dynamix
    by Dynamix
     
    Started by anton_tymoshchuk, Yesterday, 01:14 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X