Easylanguage/Multicharts still buying next bar even no more code to buy signal!
Welcome to futures io.
(If you already have an account, login at the top of the page)
futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.
At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.
With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.
We are fundamentally different than most other trading sites:
We are here to help. Just let us know what you need.
We work extremely hard to keep things positive in our community.
We do not tolerate rude behavior, trolling, or vendors advertising in posts.
We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
We expect our members to participate and become a part of the community. Help yourself by helping others.
You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple.
Easylanguage/Multicharts still buying next bar even no more code to buy signal!
I am using Multicharts and Easylanguage program to code the following:
1. Buy if low[1]>Moving average
2. Limit orders from all signal to once per bar was checked.
3. Intrabarordergeneration is true.
However it seemed the code did not recognize the buy if low[1]>MA because even it is false buy signal was generated. I noticed that this happened preceding a stop sell execution the previous bar.
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[1]>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?
Many thanks. Your code above works. I only changed (BarStatus(1) = 1) then it worked according to my strategy otherwise if it is (BarStatus(1) = 2) it takes the close of the last bar.