Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have the following code in my trading system which has IntrabarOrderGeneration set to TRUE. The problem is that it occasionally buys 2 contracts or more even if ContractsToBuy is set to true. How is this possible? Is it possible that my orders are delayed and MarketPosition is still equal to 0 on the next tick and I end up sending a duplicate order?
if MarketPosition = 0 AND Close > X then
begin
Buy ("Buy Limit") ContractsToBuy contracts next bar at (VolWAP - BuyTicksBelowVWAP*MinMove/PriceScale) limit;
end;
if MarketPosition = 0 AND Close < X then
begin
Buy ("Buy at Market") ContractsToBuy contracts next bar at market;
end;
Thank you in advance for helping me out with this one
Can you help answer these questions from other members on NexusFi?
I'm a bit confused. I don't use anything like 'ContractsToBuy' in my signals. It isn't a reserved word is it? Just a var you've defined in the strategy, or an input, right? So I am confused on how it could be a boolean (you said "set to true").
In MultiCharts you have the option of imposing a maximum position size, that MC itself will enforce even if your strategy doesn't check on its own.
Personally in my signals I tend to check the CurrentContracts figure (reserved word) so I know what my current position size is before adding to it. As an example, you could do:
Thank you very much, Mike. Often when I am stuck with EL, I find help in one of your posts
As regards, ContractsToBuy, it is my mistake in description. ContractsToBuy is an integer in my code. I will try adding the CurrentContracts check.
Anyway, is this a known problem of TS or maybe I simply do not understand this. How is situation when CurrentContracts > 0 and MarketPosition = 0 logically possible?