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 17, 2024 12:28 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: “And” and “Or” Enquiry
PostPosted: Sun Aug 11, 2013 7:29 am 
Offline

Joined: Wed Jul 17, 2013 2:36 am
Posts: 14
Hi,
I have some questions regarding the use of “And” and “Or” symbols and how they work and should be applied? How many times can they be used and can they work together. For example in my strategy I have a condition where (e.g. based on a long trade – opposite applies for short trades) in the 1st TA block if the previous bar’s (shift 1) open is below the 50EMA and if the close of the same bar is above the 50EMA. Then if the next TA block’s condition is met i.e. if the “ask” is equal to or higher than the previous bar’s close then buy (if other MACD and RSI conditions have been met). The problem I’m having is that if the “ask” is lower than the previous bar’s close (e.g. by one pip) and then the ask breaks up past the previous bar’s close the trade will not trigger. So I introduced an “OR” symbol and linked the 2nd TA ( i.e. “ask” is equal to or higher than the previous bar’s close )and another TA with a condition of if “ask” is lower than previous bar’s close then buy if other TA block and MACD and RSI conditions have been met. The strategy was working great for 30mins and then went crazy opening and closing trades at a rapid pace. I wanted to use the same “Or” logic with the MACD and RSI conditions (if either condition is met then trigger proving that all other conditions have been satisfied i.e. TA blocks) but I’m not sure if the two symbols “And” and “Or” can work together in the one strategy...that is the “Or” conditions (TA blocks) can work in conjunction with the “And” TA block conditions – meaning that the trade should only trigger if the “And” and “Or” conditions are met. If the two symbols can’t work together (logic clash) can you please advise how I can overcome my problem i.e. if the “ask” is lower than the previous bar’s close (by one pip) and then breaks up past the previous bar’s close what condition (TA Block) can I add to get the trade to trigger.
I have attached a Mol.file of my strategy to see if you can determine if I have programmed the EA correctly?

I am really looking forward to your help...


Attachments:
And Or Enq.mol [20.53 KiB]
Downloaded 364 times
Top
 Profile  
 
 Post subject: Re: “And” and “Or” Enquiry
PostPosted: Sun Aug 11, 2013 10:00 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Quote:
if the previous bar’s (shift 1) open is below the 50EMA and if the close of the same bar is above the 50EMA. Then if the next TA block’s condition is met i.e. if the “ask” is equal to or higher than the previous bar’s close then buy

These conditions in your trading diagram are independent. If you want them to work at the same time you need to join them all with an AND
If you want to trade when A and B and C takes place, you need to connect them to the same AND
You cannot do if A and B takes place, wait for C to take place. Then need to take place at the same time


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