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 Sat Apr 27, 2024 5:46 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Open & Close a trade on same 'Bar Open' & 'Bar Close'
PostPosted: Sat Feb 28, 2015 12:07 am 
Offline

Joined: Mon Jan 27, 2014 12:53 am
Posts: 12
Hi,

Does anyone know how to open a trade at 'bar open' & close a trade at 'bar close' on the same bar?

For example:

Open criteria

If bar(1) close < Bar(2) close = go short

Close Criteria

If current bar close < current bar open = close trade

Thanks a bunch
Eddie


Top
 Profile  
 
 Post subject: Re: Open & Close a trade on same 'Bar Open' & 'Bar Close'
PostPosted: Sat Feb 28, 2015 5:54 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
on mt4 there is no way to know the close until you get the next open
this is why when you trade bars you trade at the open.
you are right, the way to do it is:
If bar(1) close < Bar(2) close where (1) is the previous bar


Top
 Profile  
 
 Post subject: Re: Open & Close a trade on same 'Bar Open' & 'Bar Close'
PostPosted: Sun Mar 01, 2015 5:02 pm 
Offline

Joined: Mon Jan 27, 2014 12:53 am
Posts: 12
Thanks for that.

The only problem in closing the bar that way is that the condition for entry also includes 'If bar(1) close < Bar(2) close where (1) is the previous bar'

So what happens is it will open the trade and then close it immediately as the condition is met straight away.

Any other suggestions to get around this?

Even closing the bar say 59 sec after opening would work - is this possible?

Thanks
Eddie


Top
 Profile  
 
 Post subject: Re: Open & Close a trade on same 'Bar Open' & 'Bar Close'
PostPosted: Mon Mar 02, 2015 12:34 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Not sure I understand. Open and close conditions cannot overlap otherwise you get coninuos opening and closing


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