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 May 11, 2024 3:44 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Problem with TP and SL
PostPosted: Mon Apr 15, 2013 3:15 pm 
Offline

Joined: Mon Apr 15, 2013 2:33 pm
Posts: 2
Dear Molanis support,

I have one issue with setting the stop loss and take profit in BUY Block. I created very simple ea, just to manifest the problem (see attachment: BollingerLong.mol).

I specified the conditions which must be true to open the BUY Order.

I set the Take Profit to value: 150
I set Stop Loss to value: 100

(BB_ea_issue attachment):

#1: When the BUY position is opened it will not trigger the close order on selected "Take Profit value". It will close the position on some, for me unknown value. I dont know from where does the ea takes it.

#2: This Open BUY also not met the conditions for opening. (optional but also its interesting why this happening)

#3: According the issue mentioned above only 6 trades were done.

So question is why the TP and SL are not working and why the second position opened.

Thank You,

Kind Regards


Attachments:
BB_ea_issue.jpg
BB_ea_issue.jpg [ 607.69 KiB | Viewed 4099 times ]
BollingerLong.mol [4.48 KiB]
Downloaded 384 times
Top
 Profile  
 
 Post subject: Re: Problem with TP and SL
PostPosted: Tue Apr 16, 2013 7:45 pm 
Offline
Site Admin

Joined: Fri Oct 16, 2009 3:40 pm
Posts: 451
I think the problem is that you use a 4 digit broker. By default the ea works with 5 digits. You can change this in the ea input variables in mt4.
When you have a 5 digit setting with a 4 digit broker, your stops are 10 times bigger.
Also the tp and sl are executed by the server/broker and not by the ea. The ea only send the stops. After the position is opened check the tp and sl and you will see the right numbers.
Finally during backtesting stops are not exact because you do not have all tick info. So if your historical data goes like 1.3444 to 1.3446 and your stop is 1.3445 you may have an adjustment there.

About the ea logic, if you trade the current bar you cannot look at the chart after the fact. If you trade the current bar (shift 0) the trade is evaluated at the open, all indicators are calculated with the open price. Change the logic to shift 1 and then you can check the chart after the fact. Also, unless you really know what you are doing do not use the mql icon. You can do the same with the TA icons


Top
 Profile  
 
 Post subject: Re: Problem with TP and SL
PostPosted: Wed Apr 17, 2013 10:30 am 
Offline

Joined: Mon Apr 15, 2013 2:33 pm
Posts: 2
Thank you very much for the answer.

Yes in first case its clear to me right now. It was that problem you wrote so the TP and SL issue is solved. thank you.

But I really dont understand the second part. I will describe it little more deeply. Its a little bit different question I was asking before so sorry for that.
I would like to know how I can set the conditions to Open the BUY exactly in that time when the BID price reaches the lower Bollinger Bands or the BID crosses to lower Bollinger Bands. Maybe 5 or 10 pips below the lower mode of iBands. Not on the next open of a new bar but right in that present time.
Thanks


Top
 Profile  
 
 Post subject: Re: Problem with TP and SL
PostPosted: Wed Apr 17, 2013 9:22 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Check example 10 - it uses bollinger, change it to meet your needs
If you want the ea to trade right away you need to trade ticks and not bars (change it in the start icon). Mind you, if you trade ticks do not look at the chart after the fact since it may look that you traded wrong signals - the chart plots the close and you trade every tick so the chart is not reliable

Examples are here http://www.molanis.com/products/molanis ... rs-for-mt4 Get all of them in a zip file (example 0)


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