Manager for 10.3 trades

Share your individual manual NB 10.x trading ideas 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.

Manager for 10.3 trades

Post by SteveHopwood »

The attached management EA arose from this pm from Bob:
nanningbob wrote:Can the ability to move the jumping sl up lets say by 6 pips every 5 pips possible. It would do something like this:
set SL -18

at +5 move SL to -12
at +10 move SL to -6
at +15 move SL to 0
at +20 move SL to +5
and so on until it hits the SL or TP

A second choice would be to stop jumping stop after 5 moves or what ever you want.

Thanks,

Bob
I have not done anything about the second choice yet.
  • This is a multi-pair manager, so it will manage all trades so long as they have the same magic number as in the MagicNumber input.
  • JumpIncrementPips is the size of jump required to trigger an sl move.
  • NegativeIncrementPips are the number of pips to jump the stop whilst it is still a negative stop loss i.e. < order open price for a buy, > order open price for a sell.
  • PositiveIncrementPips are the number of pips to jump the stop once it has reached breakeven or above.
  • AlwaysOn sends the bot into an endless loop, going through its calculations twice a second. It will start immediately you load it up, so the chart is irrelevant. You only need one instance of the ea running, unless you want to manage trades with different magic numbers.
I cannot use the normal method of keeping track of when to move the stop loss and I needed a way of telling the ea where it was after a restart. For this I have used Global Variables to store the price the market must reach to trigger the next jump. Press F3 to view the GV window. The ea checks to see if a trade has closed every 15 minutes and deletes redundant GV's.

GV's are not foolproof. They are tiny files stored on you hard drive and so are as subject to corruption as are any other stored files. If any of you maths geeks can come up with a formula that allows the ea to know where it is in the jump process on a restart, then that would be better.

Use the ea to manage manual 10.3 trades and those sent by Gimme Your Hair.

:D

Matters of general interest
Go here to download and run the script that will fill your platform's missing chart history: http://www.stevehopwoodforex.com/phpBB3 ... f=15&t=254
Read this post:
http://www.stevehopwoodforex.com/phpBB3 ... p?f=6&t=78 Newbie traders, read this for inspiration and warning. Those of you who have suffered losses, read it for inspiration.

Masterly summary of hedging: http://www.forexfactory.com/showthread. ... ost4977179

EA coding
I receive may requests to code EA's. Traders, if I code your EA for free, then I will share it here. If you want me to code your EA without sharing, then my fee is $100 payable into my paypal account. I explain why at http://www.stevehopwoodforex.com/phpBB3 ... ?f=15&t=79, at the bottom of the post.

Useful utilities/EA's/scripts
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
alex_forex
Trader
Posts: 438
Joined: Tue Nov 15, 2011 5:46 pm
Location: F R A N C E

Re: Manager for 10.3 trades

Post by alex_forex »

Must solve my SL errors because of the tight stops !

Thanks Steve :D
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Manager for 10.3 trades

Post by gaheitman »

Nice! For years I've wanted a trailing stop variant that would catch up to price, but was never motivated enough to do anything about it...

As for the math, I believe you need to know the initial SL to determine where you are in the jump sequence. Since they won't always be the same, we'd have to do something to store the starting SL. I know, we could use a GV! :D

George
bshoe24
Trader
Posts: 84
Joined: Sat Feb 11, 2012 5:53 pm

Re: Manager for 10.3 trades

Post by bshoe24 »

This sounds similar to the ATM (automated trade management) of Ninjatrader which works nicely for jumping SL. Thanks Steve.
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: Manager for 10.3 trades

Post by SteveHopwood »

When I loaded the manager onto my 10.3 Scalper demo, I noticed I had left some doubles viewable to users. Altering their values in the inputs window will have no effect. If their presence bothers you, then redownload - I have removed them from sight.

: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
nanningbob
Trader
Posts: 4564
Joined: Sun Dec 04, 2011 1:23 pm

Re: Manager for 10.3 trades

Post by nanningbob »

Thanks Steve, I will get to this after school today.
I trade http://www.stevehopwoodforex.com/phpBB3 ... =38&t=3964,
I talk about my philosophy of trading here.
http://www.stevehopwoodforex.com/phpBB3 ... =38&t=3627
"The key to converting something useful to others is simplicity. Complexity is the enemy to execution." Tony Robbins
POH
Trader
Posts: 75
Joined: Thu Jun 28, 2012 6:04 am

Re: Manager for 10.3 trades

Post by POH »

Does this set an initial SL?
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Manager for 10.3 trades

Post by fxozgirl »

POH wrote:Does this set an initial SL?

No, you set you're own SL, then the EA manages the trade from there.
User avatar
fxozgirl
Trader
Posts: 1176
Joined: Wed Nov 16, 2011 9:16 am
Location: Melbourne, Australia

Re: Manager for 10.3 trades

Post by fxozgirl »

Steve, I've set this up and it looks like it is working well OOTB with some adjustments to SL already occurring correctly :D

One thing I have noticed is I've set up some pending trades and attached the EA in anticipation, however it appears to be trying to modify the trade and returning a 'trade context is busy' error for the pending trades.

Not causing any problems with actual trades, just an FYI as the error is filling up the logs.


Hmmm...just had a thought, I haven't set a magic number for any of the charts...would that be causing the error?

2012.11.07 17:28:02 Bob's 10.3 trade management EA USDJPY,M15: Bob's 10.3 trade management EA 45586675 TradeManagementModule stop loss modification failed with error 146: trade context is busy
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Manager for 10.3 trades

Post by gaheitman »

fxozgirl wrote:Steve, I've set this up and it looks like it is working well OOTB with some adjustments to SL already occurring correctly :D

One thing I have noticed is I've set up some pending trades and attached the EA in anticipation, however it appears to be trying to modify the trade and returning a 'trade context is busy' error for the pending trades.

Not causing any problems with actual trades, just an FYI as the error is filling up the logs.


Hmmm...just had a thought, I haven't set a magic number for any of the charts...would that be causing the error?

2012.11.07 17:28:02 Bob's 10.3 trade management EA USDJPY,M15: Bob's 10.3 trade management EA 45586675 TradeManagementModule stop loss modification failed with error 146: trade context is busy
The code only manages trades with a matching MagicNumber (the default is 0) that are in profit. I wouldn't think a pending order would have a profit, but I don't know that I've ever called OrderProfit() to see. :)

You are just running it on one chart, right?

Steve should probably add the standard "while trade context busy" check prior to the OrderModify() function to make sure this doesn't happen.

George
Post Reply

Return to “Manual 10.x trading”