This is not a request, but just a query whether it is conceived possible.
I’m thinking about a multipair EA, that checks the history and as soon as a trade is closed in profit, and once the pair in question still has open orders, it replaces that EXACT same order as a limit-order.
If there are other limitorders in place, they should be removed (or changed to the new numbers).
So if for example EURUSD closes a sell 1,2345 @ TP 1,2300, it enters a pending limit-sell @1,2345 with 1,2300 TP.
That’s all it should do, just replacing closed orders as long as there are other orders running.
My idea is to re-enter on a pullback, in the direction of price movement.
I’m doing it manually now, with succes, but need to check the charts often.
Update(s):
04-Jun-2018: Added (final) code to Post 1 (this post):
EA for adding limit-orders
- Gertje
- Trader
- Posts: 1936
- Joined: Mon Dec 12, 2011 1:17 pm
- Location: Middle of the Netherlands
EA for adding limit-orders
You do not have the required permissions to view the files attached to this post.
-
- Trader
- Posts: 50
- Joined: Mon Apr 13, 2015 7:58 pm
- Location: SW England.
EA for adding limit-orders
Yep, fairly straightforward to code.Gertje » Wed May 30, 2018 9:27 pm wrote:This is not a request, but just a query whether it is conceived possible.
- renexxxx
- Trader
- Posts: 860
- Joined: Sat Dec 31, 2011 3:48 am
EA for adding limit-orders
I like this statement! This is the same as when you ask someone if they know what time it is and you get the answer "Yes".JonCodesBad » Thu May 31, 2018 8:24 am wrote: Yep, fairly straightforward to code.
Anyway, Jon was right. It was fairly straightforward and I have attached the code here. Not sure if it works though, as I haven't had the time yet to test it. If it doesn't work, it will "fairly straightforward" to make it work.
Just run this EA on any chart. You can make it watch any magic number by setting the MagicNumber to -1 (the default). Otherwise, set MagicNumber to the magic number you want it monitor. It will keep track of all open trades with that magic number and will instantly discover if one of them has been closed. If so, it checks if it was closed in profit, remove the other pending trades for the same symbol in the same direction and send a new limit order for the same symbol in the same direction.
Code is in Post 1 of this thread.
Have fun.
- Gertje
- Trader
- Posts: 1936
- Joined: Mon Dec 12, 2011 1:17 pm
- Location: Middle of the Netherlands
EA for adding limit-orders
I guess that was my fault, I asked whether it would be possible at all, and got what I asked for.renexxxx » Thu May 31, 2018 3:36 am wrote:I like this statement! This is the same as when you ask someone if they know what time it is and you get the answer "Yes".JonCodesBad » Thu May 31, 2018 8:24 am wrote: Yep, fairly straightforward to code.
Thanks a lot Rene, I appreciate your involvement.Anyway, Jon was right. It was fairly straightforward and I have attached the code here. Not sure if it works though, as I haven't had the time yet to test it. If it doesn't work, it will "fairly straightforward" to make it work.
Just run this EA on any chart. You can make it watch any magic number by setting the MagicNumber to -1 (the default). Otherwise, set MagicNumber to the magic number you want it monitor. It will keep track of all open trades with that magic number and will instantly discover if one of them has been closed. If so, it checks if it was closed in profit, remove the other pending trades for the same symbol in the same direction and send a new limit order for the same symbol in the same direction.
Have fun.
I downloaded the EA and tried it on demo, it seems it has a love for AUDJPY.
When I close orders in profit, it re-opens AUDJPY pendings [see below pictures].
The EA is on EURGBP, so that can't be the culprit.
If and when you have the time, would you look into it?
Thanks again,
Gertjan
You do not have the required permissions to view the files attached to this post.
- renexxxx
- Trader
- Posts: 860
- Joined: Sat Dec 31, 2011 3:48 am
EA for adding limit-orders
Ok, I see what's going on: cursor got overwritten. I should test things before posting them.Gertje » Thu May 31, 2018 6:50 pm wrote: I downloaded the EA and tried it on demo, it seems it has a love for AUDJPY.
Code is in Post 1 of this thread.
- Gertje
- Trader
- Posts: 1936
- Joined: Mon Dec 12, 2011 1:17 pm
- Location: Middle of the Netherlands
EA for adding limit-orders
Was already printing statements when you edited your message.renexxxx » Thu May 31, 2018 9:39 am wrote:Ok, I see what's going on: cursor got overwritten. I should test things before posting them.Gertje » Thu May 31, 2018 6:50 pm wrote: I downloaded the EA and tried it on demo, it seems it has a love for AUDJPY.
Try now with the attached version.
New version works fine on several pairs, thank you.
Deleting of old limits didn't always function, ran out of open orders in profit to test more.
I will let it run and keep you posted.
Thanks a lot!
- Gertje
- Trader
- Posts: 1936
- Joined: Mon Dec 12, 2011 1:17 pm
- Location: Middle of the Netherlands
EA for adding limit-orders
It works in real time as well!
Now to get rid of these trade comments......
You do not have the required permissions to view the files attached to this post.
-
- Trader
- Posts: 50
- Joined: Mon Apr 13, 2015 7:58 pm
- Location: SW England.
EA for adding limit-orders
Glad my response was taken in the spirit it was meant. It answered the OP & made me chuckle.
Anyhows, on my way home from work I was pondering this idea. I gather Gertje's request was to aid in trading POS.
Would it make sense to limit the number of times a trade is replaced? For example in a triple top situation would you want to be replacing a 4th or 5th time.
Gertje would have the best idea if this would reduce DD, or impede profits to varying degrees.
Anyhows, on my way home from work I was pondering this idea. I gather Gertje's request was to aid in trading POS.
Would it make sense to limit the number of times a trade is replaced? For example in a triple top situation would you want to be replacing a 4th or 5th time.
Gertje would have the best idea if this would reduce DD, or impede profits to varying degrees.
- renexxxx
- Trader
- Posts: 860
- Joined: Sat Dec 31, 2011 3:48 am
EA for adding limit-orders
You want to get rid of these "[tp]"'s?Gertje » Thu May 31, 2018 10:51 pm wrote: Now to get rid of these trade comments......
Code is in Post 1 of this thread.
- Gertje
- Trader
- Posts: 1936
- Joined: Mon Dec 12, 2011 1:17 pm
- Location: Middle of the Netherlands
EA for adding limit-orders
A triple top is bound to go south, sometime in the future.JonCodesBad » Thu May 31, 2018 5:20 pm wrote:Glad my response was taken in the spirit it was meant. It answered the OP & made me chuckle.
Anyhows, on my way home from work I was pondering this idea. I gather Gertje's request was to aid in trading POS.
Would it make sense to limit the number of times a trade is replaced? For example in a triple top situation would you want to be replacing a 4th or 5th time.
Gertje would have the best idea if this would reduce DD, or impede profits to varying degrees.
Trading PoS on H4, one would have entered somewhere along the line and taken advantage of the ranging.
See below chart, the lines are almost 400 pips apart. I trade this pair with a distance between trades of 100 pips, TP is also 100 pips. I stopped counting how many pips one could have made there using my re-entering method.
I think it is worth trying, and so I am.
You do not have the required permissions to view the files attached to this post.