My EL system buys more contracts than needed - futures io
futures io futures trading



My EL system buys more contracts than needed


Discussion in EasyLanguage Programming

Updated by quaestus
    1. trending_up 1,291 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 3 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

My EL system buys more contracts than needed

(login for full post details)
  #1 (permalink)
Vilnius, Lithuania
 
 
Posts: 2 since Jul 2011
Thanks: 0 given, 0 received

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

Reply With Quote

Can you help answer these questions
from other members on futures io?
Where can I trade BTC FUTURES, and what are margin amounts
Brokers
TOS script help - crossover with alerts - help please?
ThinkOrSwim
Volume Chart Trend Lines
TradeStation
Where can I download historical tick data for HSI?
Traders Hideout
FYI plot bug & workaround: changing color or width is delayed 1 bar
EasyLanguage Programming
 
 
(login for full post details)
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 48,902 since Jun 2009
Thanks: 31,586 given, 94,525 received



quaestus View Post
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

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:

condition1 = iff(CurrentContracts < 10, true, false);

This would set condition1 to true if CurrentContracts are less than 10, and false otherwise. Assuming 10 is your max.

Then you could modify the buy condition like so:

if MarketPosition = 0 AND Close > X AND condition1 then

Just as an example.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #4 (permalink)
Vilnius, Lithuania
 
 
Posts: 2 since Jul 2011
Thanks: 0 given, 0 received

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?

Thanks

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > My EL system buys more contracts than needed


November 9, 2011


Upcoming Webinars and Events
 

Every journal equals ten meals for the hungry

Now
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts