it's hard to tell what is going on without knowing your code. It's possible that you are using a flag for the entry condition check that is not reset and simply stays true, but there are many other reasons. One could only guess without seeing the code.
I think it might also help if you share what you're trying to do. From the three points that your code does, I get that it should buy when the previous low is above a moving average value. But in point 2 you mention 'orders from all signal'. Does that mean you're combining several signals into one?
So as ABCTG says, post the code (or a reduced example that replicates the problem). But I'd add to that to also clarify your goal(s). Perhaps your code is needlessly complicating things.
Your code misses the variables and IOG declaration, which is not a big thing but it makes me wonder whether it's complete.
Why did you choose to use intra-bar order generation, by the way? If you may know, SetStopLoss is also evaluated intra-bar and thus does not need IOG, while IOG can also affect your variables' values (see IntraBarPersist).
Now there's nothing wrong with using IOG, but if you have an issue with your code I'd suggest to bring the code back to its basic form and then step-by-step add each new component to see what breaks it.
I use IOG so it can react to intra day opportunity. Here's what I did. I remove one by one all the buy signals and the result was still the same. That is it still Buy at open after the previous bar was stopped or executed a sell signal. Even I checked the "limit entries from same signal in this strategy to once per bar" it still trade the next bar. I am lost now!
I suspect that a spill over of signal from the previous bar that is executed at the next bar open. How can I ensure that the code will only buy if the condition is true. Right now even if false it still buy then immediately sell it soon after.
If I look at the code you previously posted (with the `BuyCondition` variable), then that should buy only if the condition is true. So based on that code snippet I don't see a reason why this behaviour occurs.
Have you tried outputting the variable that you use for submitting buy orders (e.g., `BuyCondition`) on every script calculation to verify that it doesn't remain true?
It might also help to double-check that the variable used for submitting the order (e.g., `BuyCondition`) is only assigned a value above the code that submits the order. If you place `BuyCondition` below the code that submits the order, then this variable will be true on the next script calculation even though it shouldn't be.
Otherwise, can you perhaps post the full script that is causing this problem? Perhaps with more eyes looking at the code we can spot the error faster.
After isolating buy signal one by one. I think I found the culprit. Since the IOG is True, the buy signal Low>var0 is executed per tick and the code is doing what it meant as coded but not what I intended to do.
I set the chart to 30 minutes and I like the last bar Low should be > var0 to buy. But unfortunately I am not getting it if the last tick low from the previous bar is higher than var0 even if the Low of the previous 30 minute bar is < var0.
How can I code that the last 30 min bar Low is > var0 to buy and IOG = True?