Jump to content

(REQ Plz) Simple Take Profit EA based on Bollinger Bands


Recommended Posts

This is the latest edition for the = Simple Take Profit EA based on Bollinger Bands compliments of Kenny

People ,please thank Kenny not me ok,I in no way want to take credit for anyone else's work.

 

Here is a minor update of the Bol_TP EA. I have removed the function that removes the EA from the chart when you load it onto a second chart of the same currency/TF by mistake. Unfortunately it was deleting my global variables when it did this which causes the scripts to malfunction. Instead now, the EA remains on the chart but is inactive. This also saves you the hassle of reloading the EA if it was a simple mistake.....just change the TF or Pair and the EA continues to work normally.

 

There is a minor issue where the lots traded reverts to fixed lots when lotsize is limited by broker minimum. This is not intentional but it still serves the same function, so I am not to worried about it.

 

http://www.multiupload.com/0S4YD0GX40

http://www.multiupload.com/BE5LM3P20P

http://www.multiupload.com/H4IKT4G6RY

http://www.multiupload.com/UHRQK9KEGY

 

The Dashboard also compliments of Kenny

 

Here is the dashboard with the stochastics filter. It is standard 9,3,3 using EMA with low/high price field parameters.

 

http://www.multiupload.com/3IVCNBP98S (Put this in the indicators folder)

 

The MA arrow only has color when the stoch is at or above 80 or below 20. Otherwise it is grey in color. The color of the arrow is still ONLY related to the PA relative to the 2 moving averages and only gets color when the stoch is overbought or oversold. The color of the arrow does not say anything about the stoch other than the fact that it outside of the 20 -80 range, so for example, it is up to you to manually check that the Price is overbought if you wish to go short.

 

Also spread is now displayed in brackets next to the currency pair.

 

Enjoy.

 

What the parameters mean in EA

 

Bol_TP_v4_Enhanced.mq4.............this is the main EA. I assume you know where this goes.

Bol_TP_Include.mqh......................this file goes in your "\experts\include" folder.

Bol_TP_BUY.mq4 & Bol_TP_SELL.mq4.....these go in your "experts\scripts" folder.

 

The settings are as follows(new ones in bold) :-

 

Use_MagicNo.....if set to true, EA will generate its own unique 8 digit Magic Number for use with the script. If set to false, Magic Number will be 0 which is the same as a manual trade.

Personal_Magic....if for some reason the auto magic number is not unique enough for you, you can add from 0 to 100 to the generated magic number.

Set_SL.............enables/disables the automatic stoploss entry

SL_Buffer.........the buffer between previous bars high/low for stoploss. Set to -1 to use auto buffer determination.

SL_Bars...........number of previous bars to use for stoploss entry. Includes the current bar.

Use_Move_BE......Enable/disable move to break even;

BE_Pips.........Move SL to break even when the profit is BE_Pips. Leave at zero to use the auto BE_Pips which equals the SL_Buffer.

------------------------

TP_Use_Timer...updates the TP2 at predetermined intervals rather than every tick. EA updates each new bar by default. This setting overides new bar and sets the TP more often.

TP_Update........number of seconds interval when changing TP2

Use_TP2_Close....use market order to close at TP2 instead of server side stop. This overides all other TP2 methods.

Show_TP_Line.....enables or disables the visual TP1 line

TP_Color.............ok, if you need help with this one, you are in the wrong place.

---------------------------

Use_Trail...............enables or disbles the trailing stop function

Trail_Percent.........this is the % of profit to trail by ie 50 pips profit = 25 pips trail.

Trail_Max..............stop will trail by the % you set eg 50% until the trail is equal to Trail_Max. Then the EA will trail at this fixed value. Set to -1 to use auto trail max which is the same as your SL_Buffer. Auto buffer is a function of ATR.

Use_Decay.............my little pride and joy. Ever watched the Price action hang within 1 pip of your TP and then reverse. With this option, the trailing stop is tightened as the Price approaches the TP2. The trail is equal to TP - Price, so if you are 5 pips short of TP, your trailing stop will equal 5 pips.

----------------------------

Use_Script..........this enables/disable the EA setting for the scripts. If set to false, you will get an error if you try and use the script. You must make a manual entry if this is set to false.

Risk..................this tells the script how much you want to risk. It is a % of your account balance. If you have it set to 1% and you have a $5000 account, the EA will calculate the trade size is limited to ensure that your loss at full stoploss = $50(1% of your account). So, the further you are from your stoploss at trade entry, the smaller the trade will be.

Fixed_Lots.........you can overide the risk setting and have the EA/script trade fixed lotsizes for you. In this case the EA will calculate and display your loss at full stoploss, as well as the risk level. Leave it at zero to use EA risk setting.....anything more than zero overides the risk setting.

----------------------------

Auto_SL_Ref.............this is a reference to adjust the Auto_SL_Buffer. If you feel that the buffer is too big or too small, use this parameter to adjust.

Mod_Threshold..........this is the EA's own internal stoplevel. Basically you don't want it sending orders to change things by 1 tenth of a pips, so I have set it here by default to only change any order if the modification will be more than half a pip. This can also be used as a jumping stop by entering a bigger number like 5 or 10 pips.

----------------------------

The rest of the settings are for the Bollinger bands. They should stay at default unless you have good reason to change them.

 

-----------------------------------------------------------------------------------------------------------------------------

When you want to trade, simply drag a Bol_TP BUY or SELL script onto the chart. You can also set hotkeys if you wish.

 

I am sure there will be many issue, so as always please report your bugs here with as much detail as possible.

 

Enjoy!

 

Guys! I can not fit all the instructions in this 1st post so head to page 15 please to see what other parameters mean thanks and sorry about the trouble.

Edited by benny3
Link to comment
Share on other sites

  • 1 month later...
  • Replies 274
  • Created
  • Last Reply

Top Posters In This Topic

http://www.multiupload.com/KNGLMPJNJK

 

This thing is a bitch to test, so I will leave it to you to test. I assume your broker supports partial closing. I am not sure if different brokers have differing procedure for dealing with a partial close but try it and let me know if there are bugs.

 

Enjoy!

 

Kudos Kenny but doesn't look to be the one i'm after it looks like that only stoploss can be placed. there's no take profit but from what i've tested even with orders open nothing happens but i will continue to test it cheers mate.

Link to comment
Share on other sites

Benny,

 

It will place your stoploss for you at whatever buffer you select above or below the previous bar high or low depending on buy or sell, assuming the high(for eg) is above your short entry(otherwise we would have invalid stops.)

 

It will wait for price action to hit the mid band of the bollnger and then it will use a market order to close half the trade and then only will it set a TakeProfit for the opposite band and move SL to the entry price. Unfortunately we cannot enter a takeprofit that closes half the order ahead of time, it can only be done via a market order.

 

Hope it helps.

Link to comment
Share on other sites

Benny,

 

It will place your stoploss for you at whatever buffer you select above or below the previous bar high or low depending on buy or sell, assuming the high(for eg) is above your short entry(otherwise we would have invalid stops.)

 

It will wait for price action to hit the mid band of the bollnger and then it will use a market order to close half the trade and then only will it set a TakeProfit for the opposite band and move SL to the entry price. Unfortunately we cannot enter a takeprofit that closes half the order ahead of time, it can only be done via a market order.

 

Hope it helps.

 

I tried to apply the paramaters to 20 pips below the lowest low but it kept on puttin the stoploss bang on low and started closing positions straight away, i mean straight away when i opened my buy it started closing one after the other here's a pic of what's meant to happen. Kudos for help tho Kenny your help is much appreciated.

 

Benny3

 

http://i25.tinypic.com/10hqgl0.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Hey Kenny the expert is doing something weird it closes positions even when it goes against me, sometimes closing it in halves like for example.......I've got a stoploss of 50 pis right and the trade moves against me 20 pips then the robot will close off half the position and then if it goes against me another 10 or 20 pips it closes another quarter until it finally reaches my stoploss. , can you please make it hit my stop only thanks.

 

And also the magic number doesn't work if i open two trades it doesn't put a stoploss on the second trade,that's even after i enter a different number in ther magicnumber box thanks kenny.

 

Benny3

Link to comment
Share on other sites

  • 2 weeks later...
Hi Benny,

 

Give me a couple of days. In the meantime any info you can supply about the misbehaviour will help greatly. Especially if you can try and capture a screenshot with the BB indi in place, so I can try and identify the problem.

 

Thanks.

 

K.

 

Sorry Kenny i've just been soo busy lately i'm getting straight onto it now.i'll post some pics if i can

Link to comment
Share on other sites

No problem Benny. It would also be usefull if you could run a test and let me know more about how your broker handles partial closes. I was testing on FXOpen and one problem I had was that they change the comment and the ticket number with a partial close which obviously causes choas. I am not sure if this is a standard MT4 way of dealing with partial closes or if it is specific to FXOpen. I, anyway, created a routine which detects the newest ticket number and used that but if your broker does not issue a new ticket, I can see problems.

 

I did test the stoploss entry and I can't seem to find a problem with that. It would be good if you could run some test trades and try determine what conditions cause the second trade stoploss to fail.

Link to comment
Share on other sites

No problem Benny. It would also be usefull if you could run a test and let me know more about how your broker handles partial closes. I was testing on FXOpen and one problem I had was that they change the comment and the ticket number with a partial close which obviously causes choas. I am not sure if this is a standard MT4 way of dealing with partial closes or if it is specific to FXOpen. I, anyway, created a routine which detects the newest ticket number and used that but if your broker does not issue a new ticket, I can see problems.

 

I did test the stoploss entry and I can't seem to find a problem with that. It would be good if you could run some test trades and try determine what conditions cause the second trade stoploss to fail.

 

Hi Kenny here is a pic of the last trade i took everything seems to be working alright.I didn't open another trade because i wasn't happy with any other set-ups. It closed half the position at center bb which was good and brought stop at break even, then put final target at end of bb..

One question though Kenny does the expert move final target with the bb or would it stay still? i'm still testing...

 

http://i38.tinypic.com/29xw5dg.jpg

http://i34.tinypic.com/2nu375t.jpg

 

This one happened all while i was asleep which was fantastic, nice one Kenny.

http://i37.tinypic.com/bffl35.jpg

 

But you know what kenny i really apreciate all your help on this, i'm tempted at the final stage of this EA to kindly give a small donation which i think you've earned. Your a real credit to this forum. And I'm very happy to be testing your EA.

 

I'm still testing on Demo by the way, and can't wait to put this baby to the test on a live account, i think it's only when opening two orders that the problem happens soo when the market opens i'll find some good setups and open 2/3 trades. Thanks a bunch Kenny.

 

Benny3

Edited by benny3
Link to comment
Share on other sites

benny, r u using powerband dominator system?

if you do perhaps ibfx partial close ea would be usefull.. but you need to nulled it so u can use on your broker platform...

it's help me alot to close partial trade when i'm away from my desk.

 

http://www.ibfx.com/Tools/Partial-Close-EA.aspx

 

Yes m4m3 i am testing it, have u trialed this technique?

Thank you very much for your help it is much appreciated as well, i will trial that one to.

Link to comment
Share on other sites

hello Benny, i know about power band and have read your thread a few times. have i got this right, this EA places a buy/sell when price touches top/bottom of BB, and manages trade for you. so it's fully automated?

 

No it's not fully Automated Kraven and i like it that way, it doesn't place the Buy and Sell you have to do it because you have to determine the 4 different types of price action setups stated in my trading journal/ Powerband Dominator website. Also wait for price to open a new bar when you find 1 of the 4 setups [Rail Road, Pinbar, Engulfing, Multiple Dojis] then enter the trade preferably off S/R,Divergence,ect. But i'm sure if your nice enough Kenny the man can do something for ya. Kudos Kenny.

 

http://i38.tinypic.com/280ryw7.jpg

Edited by benny3
Link to comment
Share on other sites

Hi Benny,

 

Thank you for your kind words. Please don't worry about any donations. I have derived a lot of benefit from this forum and this is my way of contributing in turn.

 

On to business........

 

One question though Kenny does the expert move final target with the bb or would it stay still? i'm still testing...

 

Just to answer your question......at this stage the EA sets the TP to the level of the opposite BB. It does not change the order again after that. Would you like it to update the TP if the bar changes to the next bar?

 

I have a suspicion about where the bug lies with the closing of orders. I think that if the EA closes half the current order, but for some reason fails to modify the remaining half of the trade, then the next tick will cause the EA to again close half the trade since the I use the 0 TP as a condition to tell the EA that the order has not had half closed.

 

Possibly you could have a look at the logs for the time when you had the problem. You would be looking for some sort of OrderModify error, most probably an Invalid Ticket for OrderModify error.

Link to comment
Share on other sites

Would you like it to update the TP if the bar changes to the next bar?

 

Yes thanks Kenny

 

Possibly you could have a look at the logs for the time when you had the problem. You would be looking for some sort of OrderModify error, most probably an Invalid Ticket for OrderModify error.

 

I'll have to do some forward tests Kenny, I've recently had to uninstall my metatrader and reinstall it. Also I reformated my computer and have gone from xp home to xp pro. I will let you know how my forward test go when market opens.

 

Benny3

Edited by benny3
Link to comment
Share on other sites

kenny i have an idea how this EA could be very useful for something i'm trying out but will require some modifications (simple i hope). don't want to start posting them on here as Benny currently needs your help and don't want to confuse you over my requests and his. can you PM if you'd be upto altering this to suit me. thanks..and good luck benny
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...