Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

One trade per day (only)

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

    One trade per day (only)

    Hi

    I developed a trading system which generates few signals per day (sometimes), but I want to take just the first signal of the day. One trade per day, and ignore the new triggers for the rest of the day.
    How can I code that?

    Thank you

    #2
    Unfortunately this is beyond the scope what we can provide support for.

    However, here are some hints:
    - you could code a bool flag variable in your strategy which you set once the first signal triggered
    - however, this approach will not work if you restart your strategy/NT, since the flag setting is lost and orders might have been placed. You then would need to persist the flag somehow e.g. in a file

    Comment


      #3
      Thank you, Dierk.

      1) If I want to flag the trade, how can I do it? Any reference please? I don't know how to start, really.

      2) My system generates two levels by 8AM and then I play breakouts (that's why I don't want to play it more than once a day).
      There is no trade counter function or something else to simplify the problem?

      Thank you again

      Comment


        #4
        Unfortunately I don't have any references at hand to assist you further.

        Comment


          #5
          Since I generate my own breakout levels, if I use such levels to create an order, and I generate the levels once a day, I will generate just one order per day. Correct?

          Comment


            #6
            Sorry, not sure I follow.

            Comment


              #7
              I use the data between 0AM and 8AM to generate two levels.
              Then my system looks for a breakout (support/resistance) to enter the trade.
              Since I generate such levels once a day, can I make my order conditional to such level to be different from yesterday's level?
              In this way, I will make sure to trade once a day.
              Am I correct?

              Comment


                #8
                This is a logic question and unfortunatley I don't follow. From a logic standpoint, if you want to have only one trade per day, you need to trigger this off of something that indicates you have taken a trade.

                Here is a brief example. You could create a strategy level variable named:

                private bool takenTrade = false;

                then in OnBarUpdate()

                if (FirstBarOfSession) takenTrade = false;

                if (tradeCondition == true)
                {
                takenTrade = true;
                EnterLong();
                }
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Ray,

                  I did as you suggested, but after the first trade, it won't trade anymore (since the boolean condition is met).
                  In the back test, I get just one trade for each security.

                  Comment


                    #10
                    My suggestion is guidance...You will have to debug to see what is happening.
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Ray,

                      I understood I need to "refresh" the boolean back to false at the beginning of each day.
                      Something like: if time is 00.00.00 (new day kicks in), boolean takenTrade = false.

                      I went through the online manual but could find any hint.

                      Thank you

                      Comment


                        #12
                        See post #8 for the example I provided.

                        FirstBarOfSession
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          I think I made the code right, but it doesn't work every day (sounds weird, I know).

                          I wrote in Initialize():
                          private DateTime RefreshDateTime;

                          In OnBarUpdate():
                          if (Time[0].Date > RefreshDateTime)

                          {
                          RefreshDateTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 0, 0, 0);

                          takenTrade = false;
                          }

                          Like this it should refresh at the very beginning of each day.

                          Sometimes though there are no trades - maybe I should put the whole code in Initialize() ?

                          Thank you

                          Comment


                            #14
                            You will have to debug it.
                            RayNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            663 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            376 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            110 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            575 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            580 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X