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 Tue May 14, 2024 8:58 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: EA does not close open positions
PostPosted: Tue Apr 17, 2012 6:37 am 
Offline

Joined: Tue Apr 17, 2012 6:29 am
Posts: 1
I created an EA by strategy builder as attached. The EA is supposed to close positions created by another EA. The conditions for closing positions are as below. But the EA does not close open positions as design. I would appreciate any help.

Conditions for closing buy positions:
-Either line of customized indicator touch 97
Or,
-Both Lines of customized indicator, slow-stoch.mq4, cross over


Conditions for closing sell positions:
-Either line of customized indicator touch 3
Or,
-Both Lines of customized indicator, slow-stoch.mq4, cross over


Attachments:
BDR_closenew.mol [26.83 KiB]
Downloaded 384 times
BDR_closenew.ex4 [34.46 KiB]
Downloaded 413 times
slow-stoch.mq4 [1.97 KiB]
Downloaded 367 times
Top
 Profile  
 
 Post subject: Re: EA does not close open positions
PostPosted: Tue Apr 17, 2012 3:11 pm 
Offline
Site Admin

Joined: Fri Oct 16, 2009 3:40 pm
Posts: 451
If you want to close conditions created by another ea you need to use the same magic number(s) for both eas.
Expert advisors for metatrader use an id called the magic number, we use one for long positions and one for short positions. You can see then in mt4 unde the ea inputs.
By default eas created with molanis strategy builder close positions that have the same magic number, and positions with magic number = 0 (0 means manually opened)
Build an ea with a simple condition to test that closing work fine and then revisit your posted ea.


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