Announcement

Collapse
No announcement yet.

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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    43 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    27 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    163 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    98 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    158 views
    2 likes
    Last Post CaptainJack  
    Working...
    X