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 Mon May 13, 2024 10:56 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to connect AND & OR
PostPosted: Tue Sep 25, 2012 8:36 am 
Offline

Joined: Wed May 02, 2012 1:09 pm
Posts: 10
I have two indicators only. The conditions to open a trade it's as follow: If the first indicator met his own condition in the previous bar (shift 1) and the second indicator met his own condition only in any of the last 3 previous bars.

First indicator met condition in bar 1 + Second indicator met condition in bar 1 -------> Ok, open a trade.
OR
First indicator met condition in bar 1 + Second indicator met condition in bar 2 -------> Ok, open a trade.
OR
First indicator met condition in bar 1 + Second indicator met condition in bar 3 -------> Ok, open a trade.

Can I connect AND Block to OR Block? How can I build this parameters together?

Thanks for your help!


Top
 Profile  
 
 Post subject: Re: How to connect AND & OR
PostPosted: Tue Sep 25, 2012 10:34 am 
Offline

Joined: Sun Jun 19, 2011 9:38 pm
Posts: 270
Sometimes the logic puzzle is tougher than creating the trade conditions. :)

Forget about OR and try:

A1 AND B1.
A2 AND B2.
A3 AND B3.

Connect each trio from START to BUY/SELL independently of the other two. The resulting EA should check all 3 possible "paths" separately.

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


Top
 Profile  
 
 Post subject: Re: How to connect AND & OR
PostPosted: Fri Oct 05, 2012 1:44 pm 
Offline

Joined: Wed May 02, 2012 1:09 pm
Posts: 10
Thanks a lot RJo, It works perfect now!!! ;)


Top
 Profile  
 
 Post subject: How to connect OR
PostPosted: Fri Oct 26, 2012 11:01 am 
Offline

Joined: Fri Feb 04, 2011 9:48 pm
Posts: 114
Location: Canada
Got a question for Somebody:

When building an EA, I can have several TA blocks, connect all with an OR, then to BUY/SELL, then to END. The result will be when any one are true, the EA will proceed to the BUY/SELL block.

If I don't use the OR, but simply connect each TA block to the BUY/SELL block, the result will be the same, because the EA checks each condition separately, and as soon as one is true, it proceeds.

So, I can't see any difference in these two scenarios -- when would be a common occasion that I would need an OR?

Just curious to see if I am missing something.

_________________
Building a future with automated trading


Top
 Profile  
 
 Post subject: Re: How to connect AND & OR
PostPosted: Fri Oct 26, 2012 9:41 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
You are are right. Results are the same. Having an Or icon makes it easier to visualize.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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