Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with multiple entries on same signal

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

    Problem with multiple entries on same signal

    Hi,

    I was wondering if anyone had an idea on how I could fix a problem I have while trying to simulate real-time trading.

    Basically my problem is that I get an entry signal for a long or short position, and it enters it like it's supposed to. However, the price is going back and forth a few ticks making it hit the entry signal several times, and fills up my "entries per direction" in a matter of minutes.

    It works fine on back testing because it runs on daily bars and it always get it's signal at the close of each bar.

    What I want it to do is:
    Hit the entry signal and enter a position with my default quantity -> Hold for at least 1 or 2 days -> Then run the algo again and look for a new entry/exit signal.

    I tried using BarsSinceEntry() > 0 (and 1), but I realized that it won't do anything with that because there is no entries yet.

    I hope I managed to make my problem understandable.

    #2
    Hi Stoop, do you run this in realtime with CalculateOnBarClose set to false, so creating whipsaws intrabar with decisions getting full-filled and then negated again through price action?

    Comment


      #3
      Hey,

      Yes, I'm running my strategy in real-time with CalculateOnBarClose() = false. It does create "whipsaws" in the sense that it fills up all my long entries (or short), while it should have only filled one long or short entry. This is caused by the price action moving in and out of my entry signal.

      I figured I had to set CalculateOnBarClose = false, in order to get my entries at the times I wanted. Else I had to make a multi time frame strategy.

      Comment


        #4
        Thanks for the reply, then I would just run a tracking bool to ensure only one entry gets executed per day / session. You can reset the bool on a new day then to allow for new entries, but it would stop the whipsaws seen, by allowing only the first tick that triggered the signal to execute.

        Comment


          #5
          Thank you for your reply. I'm not too experienced with programming so I have pretty much just learned things as I go.
          By adding a tracking bool, would something like this work:

          (under variables) bool LongEntry = true;

          protected override void OnBarUpdate()
          {
          if (BarsSinceEntry() > 1)
          {
          LongEntry = true; // make it true if 1 bar since last entry has gone by
          }
          if (code for entry && LongEntry) //entry signal with the added bool
          {
          EnterLong()
          LongEntry = false;
          }
          }

          Would something like this work, or am I way off?

          Comment


            #6
            From a visual I think it looks good stoop.

            Comment


              #7
              Ok, I will try using that then.
              Thanks again for your help!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              649 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              370 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              573 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              576 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X