Click and drag take profit and stop loss EA

User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Click and drag take profit and stop loss EA

Post by SteveHopwood »

YOU MUST UNDERSTAND HOW TO USE EA'S IN ORDER TO USE THIS EA. DO NOT USE IT UNTIL YOU KNOW HOW TO USE Empty4 EXPERT ADVISORS. DO NOT BLAME ME IF YOU MUCK UP.

This one is for manual traders. It will:
  • pick up on your stop losses and take profits.
  • draw a dotted line of a colour of your own choice that marks the sl/tp on your screen.
  • adjust the sl/tp as you select and drag the line to a different price.
  • invoke Stealth, so that your market maker will see a far distant sl/tp that is nowhere near your 'real' stops.
  • close the trade when your sl/tp lines are crossed.
It does this with multiple trades - I have tested two open trades on the same chart so far.

Do not send a sl/tp with your manual trade. Instead, allow the ea to insert it for you.

Note: enter pips inputs as as proper pips and forget the x digit crap. The ea does all the necessary conversion, thanks to Lifesys.

The inputs:
  • InstantTpPips: your actual take profit in pips. Stealth takes care of the tp hidden from your market maker. The ea draws the tp line at this level. If the market crosses this line in the correct direction, it will close the trade.
  • InstantSlPips: your actual stop loss in pips. Stealth takes care of the sl hidden from your market maker. The ea draws the sl line at this level. If the market crosses this line in the correct direction, it will close the trade.
  • PipsHiddenFromCriminal: the ea adds this to your stop loss and take profit and sends them as 'hard' stops that your market maker sees. It is there for dire emergencies when your computer has lost contact with your mm's server. If you have been reading CJ's thread at http://www.stevehopwoodforex.com/phpBB3 ... =59&t=1572 you will know why the default for this input is so big - and if you have not despite all my encouragement to do so, then you are an idiot who deserves to lose your deposit.
  • Color.TakeProfit and its stop loss counterpart give you the choice of line colours.
  • MagicNumber: this allows you to use the ea to manage the stops of trades entered using different trading systems. So, for example, if you want to manage CJ trades but not 10.4 trades on the same platform, then you need a script that will enter CJ trades that allows you to use a magic number. Set the ea MagicNumber to the same as that of the script, and it will ignore everything else.
This is a one ea per chart ea. It manages only the trades that belong to the chart symbol and magic number it is loaded onto.

If you leave the ea running on a chart, it will seamlessly pick up on a new trade as soon as you take it.

There is a small hitch with the stop loss function that causes the ea to: enter the missing sl; delete it; replace it at the next tick. I cannot work out what causes this but it does no harm. If any coder can see what I have done wrong, please sing out.

Use this on demo whilst the markets are quiet, so we can make sure there are no bugs lurking in the woodwork.

rthien's upgrade
rthien has adapted the EA so it works with pending trades as well as market trades. Find this at http://www.stevehopwoodforex.com/phpBB3 ... 687#p58687

:D
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

Re: Click and drag take profit and stop loss EA

Post by mobthehop »

Steve, fantastic - was looking a long time for this........ goes onto my charts immediately...

Cheers
User avatar
KevinT
Trader
Posts: 113
Joined: Fri Jan 06, 2012 4:23 am

Re: Click and drag take profit and stop loss EA

Post by KevinT »

Wonderful Steve a scale in tool for advanced 10.4 trading! Will make a kill on trending markets :D
madpipa
Trader
Posts: 62
Joined: Fri Oct 19, 2012 12:59 am
Location: Gold Coast, Australia

Re: Click and drag take profit and stop loss EA

Post by madpipa »

Hi Steve,

Thanks for the indicator - very handy.

I'm not a programmer, but... I swapped the line with SetTp & placed it above the SetStop in the start routine. It then repeated the problem, but this time with the tp being set, then zeroed, then reset. So I set it back to the original order.

I had a look through the code & am thinking that when SetTp() is called from within start() that OrderStopLoss() has not yet been populated, so the OrderModify receives a "0" for the SL value. Then the next time around it reads the trade again after using OrderSelect() which now populates the SL.

I tried using RefreshRates() but I really have no idea just where it should be placed.

Hope this might help you. If not, sorry for the babble. Have a nice break Steve.

Cheers,
Mick
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Click and drag take profit and stop loss EA

Post by SteveHopwood »

Thanks for looking madpipa.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
Fable
Trader
Posts: 115
Joined: Mon Sep 17, 2012 2:05 pm

Re: Click and drag take profit and stop loss EA

Post by Fable »

Great ! Thanks Steve, will try it ! Love the idea to hide things from my broker :twisted:
User avatar
rthien
Posts: 7
Joined: Tue Nov 15, 2011 10:47 pm

Re: Click and drag take profit and stop loss EA

Post by rthien »

Steve,

I've tried the EA and works as stated. I noticed that you have not applied the "Color.TakeProfit" and "Color.StopLoss" options into the code, so the color of those lines are hard-coded at present.

See lines 166 and 191.

_Roger
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Click and drag take profit and stop loss EA

Post by SteveHopwood »

rthien wrote:Steve,

I've tried the EA and works as stated. I noticed that you have not applied the "Color.TakeProfit" and "Color.StopLoss" options into the code, so the color of those lines are hard-coded at present.

See lines 166 and 191.

_Roger
Cheers. Forgot that. Will correct this later.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Click and drag take profit and stop loss EA

Post by SteveHopwood »

Done the correction for the colour thingy. You do not need the update if you are happy with the defaults.

Update is post 1.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Click and drag take profit and stop loss EA

Post by SteveHopwood »

Tiny bloop in the update, so sorry, but the one individual to have downloaded between reading my previous and this needs to re-download.

Oops.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
Post Reply

Return to “Utilities”