Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limitation to one trade per day

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

    Limitation to one trade per day

    Hello,

    I'd like my strategy makes only one trade per day. I read this:


    but I use 5M timeframe instead of 1D. I thought about something like this:

    int m=Minute{60;}
    int midnight=ToTime(Time[0])-(ToTime(Time[0]%ToDay(Time[0])*m));
    int start_of_day=midnight+ToTime(Time[0]=80000);
    if {oop>=start_of_day && (Performance.AllTrades.Count>0)return;}

    but I don't have idea about oop=Order Open Time. I know there is IExecution and IOrder.

    thank you

    #2
    Hello kot_filemon,

    Thanks for your post.

    We have a reference sample that directly addresses how to limit your trades here: http://www.ninjatrader.com/support/f...ad.php?t=19182

    Comment


      #3
      Hello Paul,

      thank you for answer. I don't know, but this code doesn't work correctly. I changed only maxTrades:
      maxTrade=1;

      Appeared few errors after backtest. Main questions are below:
      1. What in this case mean "one trade" ? very often there are more than 1 trade. There are 2 trades during one day. Sometime 3. Example-system open and close position. Next open trade but doesn't close it in the same day. Next day close position, opened day before.
      2. Why system open and close trades in the same time? What for?
      3. Where system "know" the start of day if you use CurrentDayOHL() function from? What about forex 24h?



      Attachement contains errors.
      thank you.
      Attached Files

      Comment


        #4
        Hello kot_filemon,

        Thanks for your reply.

        I'm not sure what your session template is that is being used but that is what would control the CurrentDay indicator as well as the strategy variables being reset and ultimately control (in the reference strategies case) the first and only trade of the session. I suspect that if you examine the chart that it would show the CurrentDay indicator creating effectively a box for each session and that you would see only one trade within that session/box.

        I applied the strategy to a backtest of $EURUSD, 15 minute bars, with a "24x5" session template and only experience one trade per session (per day) from the period January 1 - May 26, 2015.

        I repeated the test with the "Forex" session template and again experience only one trade per day/session.

        I repeated the test with "24x7" session template and did find that there were more trades because there were more sessions included with the Saturday and Sunday. In this case you would technically experience more than one trade per day but still only experience one trade per session. I do not recommend using the 24x7 template for Forex if you wish to limit to 1 trade per day.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        87 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        47 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        66 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        69 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        58 views
        0 likes
        Last Post CarlTrading  
        Working...
        X