molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Fri May 10, 2024 1:00 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: One Cancels The Other (OCO)
PostPosted: Mon Mar 12, 2012 2:53 pm 
Offline

Joined: Sun Mar 11, 2012 8:28 am
Posts: 11
Hi everyone,

is it possibile, once a TA has sent 2 pending orders, that when one of the 2 orders is executed, the other is automatically canceled?

thank you,

John.


Top
 Profile  
 
 Post subject: Re: One Cancels The Other (OCO)
PostPosted: Mon Mar 12, 2012 3:37 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Not with the current version, you need the count of opened positions which is not avaiable yet (will be this summer) - you can use the delete pending icon but it will delete all pendings


Top
 Profile  
 
 Post subject: Re: One Cancels The Other (OCO)
PostPosted: Thu May 31, 2012 3:00 pm 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
I have a similar issue... I think.

I'd like to enter, say... 5 max positions, each position entered at a different level of the same indicator. I envision 5 couplings of TA blocks with BUY blocks, but I don't see how I can prevent TA #1 from triggering 2 to 5 positions in a whipsawing market. molanisfx, is or will this be possible? For now, I'm going on the hunt for the relevant code/tutorial.

_________________
I'm not a programmer, but I play one on TV.


Top
 Profile  
 
 Post subject: Re: One Cancels The Other (OCO)
PostPosted: Thu May 31, 2012 4:39 pm 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
//From what I've found:

int Orders=OrdersTotal();

//and then...

if (Orders==0)
//TA #1 trade logic
else return;

//and then...

if (Orders==1)
//TA #2 trade logic

else return;

//and so on. I will add orderselect and symbol later.

//I don't expect free coding but am I on the right track?

_________________
I'm not a programmer, but I play one on TV.


Top
 Profile  
 
 Post subject: Re: One Cancels The Other (OCO)
PostPosted: Fri Jun 01, 2012 8:07 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
If you want to code and have a pro version you can see some code that counts the transactions. It would be easier to use that one. Just pay attention to the code that counts max positions


Top
 Profile  
 
 Post subject: Re: One Cancels The Other (OCO)
PostPosted: Fri Jun 01, 2012 8:39 am 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
Got it... and got it. Thanks.

_________________
I'm not a programmer, but I play one on TV.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009