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 fitzsimmonsxz, Today, 10:44 PM
    0 responses
    2 views
    0 likes
    Last Post fitzsimmonsxz  
    Started by FAQtrader, Today, 10:05 PM
    0 responses
    2 views
    0 likes
    Last Post FAQtrader  
    Started by Damocoleman, 03-30-2022, 09:49 AM
    17 responses
    1,235 views
    0 likes
    Last Post Mykro
    by Mykro
     
    Started by junkone, Yesterday, 02:19 PM
    5 responses
    69 views
    1 like
    Last Post junkone
    by junkone
     
    Started by reynoldsn, Today, 07:19 PM
    0 responses
    9 views
    0 likes
    Last Post reynoldsn  
    Working...
    X