• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 1:07am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:07am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Scaling in Script 22 replies

need help on SL management EA for position trading & pyramid 3 replies

Snowballing On The Corrective Waves (A Complete Trading System) 42 replies

EA or Script for scaling out of trades...? 1 reply

scaling in/scaling out - how do you do it? 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: Do I need a script or an EA here? Pyramid/Snowballing/Scaling In
Cancel

Do I need a script or an EA here? Pyramid/Snowballing/Scaling In

  • Post #1
  • Quote
  • First Post: Mar 9, 2010 9:37am Mar 9, 2010 9:37am
  •  permanentjaun
  • | Joined Oct 2006 | Status: Member | 655 Posts
In a perfect world I would like this to be a script that I could assign a hotkey to, but I'm not sure a script is capable of what I want it to do.

I'd like to manually trade a chart and time an initial entry into the beginning of a run of X amount of pips. I'll give an example in terms of pips so it's easy to understand.

I enter long in a trade. My TP is 50 and SL is 10. Price moves up 10 pips and now I want to add to my position. I add another lot to my long order, but now have a TP of 40 and SL of 10. I move the INITIAL orders SL to breakeven, which is the same price as the 2nd orders 10 pip SL.

Price moves another 10 pips and I want to add to my position again. I add some more lots to my position with a TP of 30 and SL of 10. I move the SL for the first two positions to the new SL of this third position.

I'd like this type of sequence to continue for somewhere around 5-7 levels. All of the positions would close at the same ending TP.

Any questions?

So do I need a script or can this type of function only be accomplished with an EA? Is there anything like this already out there and built for me to use?

Thanks,
Matt
  • Post #2
  • Quote
  • Mar 9, 2010 2:44pm Mar 9, 2010 2:44pm
  •  7bit
  • Joined Mar 2009 | Status: Member | 1,231 Posts
I would do this with an EA rather than a script but both methods could be implemented. If you chose to do it with a script that is started with a hotkey you need to make it run in an infinite loop that checks current price a few times per second and waits the rest of the time in a call to sleep().

If you do it with an EA you would let it act only on calls to the start() function, this is the common way EAs normally work, although it is perfectly valid in certain cases to also use the same technique with an infinite sleep()-loop in an EA. These cases are when you quickly want to react to user input without waiting for the next tick.

In case you are implementing it as an EA you can not easily use hotkeys (you can but it would involve some helper scripts and global variables) to start it, instead your EA would be attached to the chart and simply do nothing, just wait for your command.

For entering the start and stop commands for the EA the easiest way is to place two text labels in the chart (which will act as buttons), name them "start" and "stop" and then permanently let the EA check their position (their coordinates in the chart). Such a "button" is "pressed" not by simply clicking it (this can not be detected by your EA) but instead by selecting it with the mouse and moving it away a few pixels. The EA can detect this move and then start the trading (or stop it when the stop "button" was moved). After it has detected such a move it should immediately move the label back to its initial coordinates.
 
 
  • Post #3
  • Quote
  • Mar 9, 2010 2:57pm Mar 9, 2010 2:57pm
  •  permanentjaun
  • | Joined Oct 2006 | Status: Member | 655 Posts
Thanks for the reply. That sounds incredibly complex to code.

I was thinking it might be easier to create two separate EA's; one which would be a buy EA and another that would be a sell EA. Open two charts for the currency I'm trading and load each EA on to one or the other. Then when I want to buy, for example, I go to the chart with the buy EA and click 'allow live trading'. Maybe that would be easier?

Anyone want to try coding something? Willing to pay for something reasonable although I'm fine with it being public so others can use it. It's just a money management portion of a system. Nothing secret here.
 
 
  • Post #4
  • Quote
  • Mar 9, 2010 3:16pm Mar 9, 2010 3:16pm
  •  7bit
  • Joined Mar 2009 | Status: Member | 1,231 Posts
Quoting permanentjaun
Disliked
Thanks for the reply. That sounds incredibly complex to code.
Ignored
No, just a few lines of code. Sounds more complicated than it is. Using more than one EA would be more complicated / more difficult to maintain.
 
 
  • Post #5
  • Quote
  • Mar 9, 2010 4:11pm Mar 9, 2010 4:11pm
  •  permanentjaun
  • | Joined Oct 2006 | Status: Member | 655 Posts
Would you be able and willing to throw something together then?

I would like to adjust the TP/SL and lot size of each trade individually in the series.

I'm not sure how it would be easiest to code the entry points. For example, is it easier to say I want the next position to be added every 10 pips and the EA uses this for all the positions or is it easier to designate how many pips above current price each position should be added individually? Either way works for me as I don't think I will adjust the entry points to not be even as I ride the trend.

The only other issue I see is playing around with how many positions I add. For example, what if I feel this trend is going to run 60 pips versus 120 for another trend. I would be able to profit more on the 120 if I allow the EA to build positions ever 10 pips for 10 levels. This is in contrast to expecting only a 60 pip run where I may only add positions every 10 pips for 4 levels. I wouldn't want to trade 10 levels on the 60 pip run because it'll never reach TP. I wouldn't want to trade 4 levels on the big run because I'd miss a lot of potential profit.

How would the EA then allow me to shut down and turn on certain levels? I don't know. Perhaps if I set lot size to zero at certain levels that the EA would realize this and not bother with that trade? Or it would just be a dirty work around..

Let me know if you can do this.

Thanks,
Matt
 
 
  • Post #6
  • Quote
  • Mar 9, 2010 4:25pm Mar 9, 2010 4:25pm
  •  7bit
  • Joined Mar 2009 | Status: Member | 1,231 Posts
I cannot promise that i can dedicate enough time to this project / move it forward in my todo list so that it would be ready in a reasonable time. Although it would not be complicated, I generally don't release half-baked things so it would still take me some time until the code is clean enough to give it away.

I may instead release a similar semi-automatic pyramiding EA i am currently working on soon, although with a slightly different logic.

Changing the size, even if it is already running is easy. You could make it an external parameter that can be changed while the EA is still running or even better: it can be marked by a horizontal line that can be moved with the mouse and would represent your takeprofit. It would simply add positions until this line is reached.
 
 
  • Post #7
  • Quote
  • Mar 16, 2010 8:09am Mar 16, 2010 8:09am
  •  7bit
  • Joined Mar 2009 | Status: Member | 1,231 Posts
This is not exactly your system, because the stoplosses will scale out gradually and not all trades at once (unless you hit the stop button or manually place the stop-line at a certain level) but you might be interested:

http://www.forexfactory.com/showthread.php?t=226059

It is interesting for you because of two reasons: This EA can manage a short-term pyramid and you are interested in pyramiding, and the EA shows possible ways to implement user interaction with a running EA (You might be interested in the functions labelButton() and crossedLine() defined in common_functios.mqh which can also be found on this website).
 
 
  • Post #8
  • Quote
  • Last Post: Aug 25, 2018 3:59am Aug 25, 2018 3:59am
  •  noobtraders
  • | Joined Jan 2018 | Status: Junior Member | 4 Posts
Hi,

Can you help with a pyramid-ish trade management EA ?

Basically, i just want the EA to change all stop loss from the same symbol to the latest Order stop loss, it would be great if it can submit order too but without is also fine.

Anyway, here is how it looks :
I open sell order, let's call it X, at GBPUSD @1.00000 with 10 pips stop loss so X-10, when it goes 20 in my direction i would like it to make another order, let's call it Y, or i can place the order before hand with -10 pips stop loss and i would like to change the last 10 stop loss to the new 10 pips stop loss ( X + 10 or Y - 10 ), when again it goes 20 pips in my direction, i would like to make another order, let's call it Z, with -10 stop loss and change X and Y stop loss to ( Z-10 and X +30 and Y + 10 )

Is it actually possible to automate this process and make it EA or Script on MT4 ? Can you help me with this ? i am not really sure about the EA in this thread but it seemed like to need a bit of tweak to be pyramid-ish trade management EA.

I hope you can help, Thanks !
 
 
  • Platform Tech
  • /
  • Do I need a script or an EA here? Pyramid/Snowballing/Scaling In
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023