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

Open & Close a trade on same 'Bar Open' & 'Bar Close'
http://www.molanis.com/forum/viewtopic.php?f=6&t=6127
Page 1 of 1

Author:  EddieII [ Sat Feb 28, 2015 12:07 am ]
Post subject:  Open & Close a trade on same 'Bar Open' & 'Bar Close'

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

Author:  molanisfx [ Sat Feb 28, 2015 5:54 pm ]
Post subject:  Re: Open & Close a trade on same 'Bar Open' & 'Bar Close'

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

Author:  EddieII [ Sun Mar 01, 2015 5:02 pm ]
Post subject:  Re: Open & Close a trade on same 'Bar Open' & 'Bar Close'

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

Author:  molanisfx [ Mon Mar 02, 2015 12:34 pm ]
Post subject:  Re: Open & Close a trade on same 'Bar Open' & 'Bar Close'

Not sure I understand. Open and close conditions cannot overlap otherwise you get coninuos opening and closing

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/