• 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

Strategy Start Time Greater than End Time

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

  • NinjaTrader_Jim
    replied
    Hello Kubera2024 and EC_Chris,

    I have included an export for my demonstration video yesterday. This can be tested in the Strategy Analyzer and the prints that show if the filter "trade" becomes true or false can be observed in the NinjaScript Output window.

    For the thread's reference, additional examples on time checks can be seen in the sample here: https://ninjatrader.com/support/foru...ead.php?t=3226

    Please let us know if we can be of further assistance.
    Attached Files

    Leave a comment:


  • Kubera2024
    replied
    Same issue, I just reset strategy on start of each interval. Like time 1 to 160000 or 170000 to 240000

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello EC_Chris,

    Thanks for opening the thread.

    I suggest to add debug prints to your code so you can see if this trade bool is getting set appropriately, or if there is another part of the logic that is preventing your orders from submitting.

    I have created a demonstration showing how debugging prints can be used with the Strategy Analyzer to analyze the strategy logic.

    Demo: https://www.screencast.com/t/nDBZkW9s

    Additional tips on debugging can be found here: https://ninjatrader.com/support/foru...ead.php?t=3418

    Please let me know if you have any additional questions.

    Leave a comment:


  • EC_Chris
    started a topic Strategy Start Time Greater than End Time

    Strategy Start Time Greater than End Time

    I have an issue with strategy start and end time

    Based on this thread
    https://ninjatrader.com/support/foru...ad.php?t=57715

    I am using this code

    Code:
    if(StartTime<StopTime
    					&& ToTime(Time[0]) >= (StartTime * 100) 
    					&& ToTime(Time[0]) <= (StopTime * 100))
    					
    					trade=true;
    
    				else if (StartTime>StopTime)
    				{
    					if ((ToTime(Time[0]) >= (StartTime*100) && ToTime(Time[0]) <= 235959) || ToTime(Time[0]) < (StopTime * 100))
    					
    					trade=true;	
    				}		
    				
    				else
    					trade=false;
    Inputs for start and end time are:

    Code:
    				StartTime = 1500;
    				StopTime = 1230;

    So the strategy crosses over sessions.

    It seemed like it worked, but it is not working anymore. This has been a real headache, is there a simpler way to code this?

Latest Posts

Collapse

Topics Statistics Last Post
Started by TazoTodua, Today, 12:29 PM
1 response
21 views
0 likes
Last Post bltdavid  
Started by sdauteuil, Today, 03:16 PM
0 responses
6 views
0 likes
Last Post sdauteuil  
Started by Zenersev, Today, 02:11 PM
0 responses
4 views
0 likes
Last Post Zenersev  
Started by TazoTodua, Today, 12:00 PM
0 responses
7 views
0 likes
Last Post TazoTodua  
Started by martyn73, Today, 08:56 AM
0 responses
10 views
0 likes
Last Post martyn73  
Working...
X