Pending Orders EA...Can someone PLEASE code this for me?

 

It's a really simple long order...harder to explain than it is to code...I think... LONG ENTRIES EA input screen(user manual inputs are in BOLD font)

Position (Initial) price = 1.3000

Position (Initial) lot size = 0.1 lot

Pip Increment for each additional position = 10 pips

Stop Loss = 30 pips [0 means NO stop loss will be set on ANY order]

Take Profit = 100 pips [0 means NO take profit will be set on ANY order]

Breakeven for each position = 40 pips [0 means NO breakeven will be set on ANY order]

Position (A) lot size = 0.1 lot [0 means NO pending order for Position (A)]

Position (B) lot size = 0.1 lot [0 means NO pending order for Position (B)]

Position (C) lot size = 0.1 lot [0 means NO pending order for Position (C)]

Position (D) lot size = 0.1 lot [0 means NO pending order for Position (D)]

Position (E) lot size = 0.1 lot [0 means NO pending order for Position (E)]

Position (F) lot size = 0.1 lot [0 means NO pending order for Position (F)]

Position (G) lot size = 0.1 lot [0 means NO pending order for Position (G)]

For example: If I typed in the values above and activate this LONG EA

  1. If current price is below 1.3000, then set a BUY STOP order at 1.3000 for Position (Initial); if current price is above 1.3000, then set a BUY LIMIT order at 1.3000 for Position (Initial); order size = 0.1 lot; take profit = 1.3100 (1.3000+100pips); stop loss = 1.2970 (1.3000-30pips); move stop loss to 1.3000 (breakeven) when price is at 1.3040 (1.3000+40pips)
  2. Only after Position (Initial) is executed, then:

  3. Position (A) – set pending BUY LIMIT order for 0.1 lot at 1.2990 (1.3000-10pips); take profit = 1.3090 (1.2990+100pips); stop loss = 1.2970; move stop loss to 1.2990 (breakeven) when price is at 1.3030 (1.2990+40pips)
  4. Position (B) – set pending BUY LIMIT order for 0.1 lot at 1.2980 (1.2990-10pips); take profit = 1.3080 (1.2980+100pips); stop loss = 1.2970; move stop loss to 1.2980 (breakeven) when price is at 1.3020 (1.2980+40pips)
  5. Position (C) – set pending BUY STOP order for 0.1 lot at 1.3010 (1.300+10pips); take profit = 1.3110 (1.3010+100pips); stop loss = 1.2970; move stop loss to 1.3010 (breakeven) when price is at 1.3050 (1.3010+40pips)
  6. Position (D) – set pending BUY STOP order for 0.1 lot at 1.3020 (1.3010+10pips); take profit = 1.3120 (1.3020+100pips); stop loss = 1.2970; move stop loss to 1.3020 (breakeven) when price is at 1.3060 (1.3020+40pips)
  7. Position (E) – set pending BUY STOP order for 0.1 lot at 1.3030 (1.3020+10pips); take profit = 1.3130 (1.3030+100pips); stop loss = 1.2970; move stop loss to 1.3030 (breakeven) when price is at 1.3070 (1.3030+40pips)
  8. Position (F) – set pending BUY STOP order for 0.1 lot at 1.3040 (1.3030+10pips); take profit = 1.3140 (1.3040+100pips); stop loss = 1.2970; move stop loss to 1.3040 (breakeven) when price is at 1.3080 (1.3040+40pips)
  9. Position (G) – set pending BUY STOP order for 0.1 lot at 1.3050 (1.3040+10pips); take profit = 1.3150 (1.3050+100pips); stop loss = 1.2970; move stop loss to 1.3050 (breakeven) when price is at 1.3090 (1.3050+40pips)

So based on the example above, the pending orders would look like this:

Only after Position (Initial) is executed at 1.3000, then

2 Pending BUY LIMIT orders (A, B) is placed BELOW 1.3000

5 pending BUY STOP orders (C, D, E, F, G) is placed ABOVE 1.3000

 

Here is the logic for the SHORT ENTRIES EA (similar to the LONG ENTRIES EA above)

SHORT ENTRIES EA input screen(user manual inputs are in BOLD font)

Position (Initial) price = 1.3000

Position (Initial) lot size = 0.1 lot

Pip Increment for each additional position = 10 pips

Stop Loss = 30 pips [0 means NO stop loss will be set on ANY order]

Take Profit = 100 pips [0 means NO take profit will be set on ANY order]

Breakeven for each position = 40 pips [0 means NO breakeven will be set on ANY order]

Position (A) lot size = 0.1 lot [0 means NO pending order for Position (A)]

Position (B) lot size = 0.1 lot [0 means NO pending order for Position (B)]

Position (C) lot size = 0.1 lot [0 means NO pending order for Position (C)]

Position (D) lot size = 0.1 lot [0 means NO pending order for Position (D)]

Position (E) lot size = 0.1 lot [0 means NO pending order for Position (E)]

Position (F) lot size = 0.1 lot [0 means NO pending order for Position (F)]

Position (G) lot size = 0.1 lot [0 means NO pending order for Position (G)]

For example: If I typed in the values above and activate this SHORT EA

  1. If current price is below 1.3000, then set a SELL LIMIT order at 1.3000 for Position (Initial); if current price is above 1.3000, then set a SELL STOP order at 1.3000 for Position (Initial); order size = 0.1 lot; take profit = 1.2900 (1.3000-100pips); stop loss = 1.3030 (1.3000+30pips); move stop loss to 1.3000 (breakeven) when price is at 1.2960 (1.3000-40pips)
  2. Only after Position (Initial) is executed, then:

  3. Position (A) – set pending SELL LIMIT order for 0.1 lot at 1.3010 (1.3000+10pips); take profit = 1.2910 (1.3010-100pips); stop loss = 1. 3030; move stop loss to 1.3010 (breakeven) when price is at 1.2970 (1.3010-40pips)
  4. Position (B) – set pending SELL LIMIT order for 0.1 lot at 1.3020 (1.3010+10pips); take profit = 1.2920 (1.3020-100pips); stop loss = 1. 3030; move stop loss to 1.3020 (breakeven) when price is at 1.2980 (1.3020-40pips)
  5. Position (C) – set pending SELL STOP order for 0.1 lot at 1.2990 (1.3000-10pips); take profit = 1.2890 (1.2990-100pips); stop loss = 1. 3030; move stop loss to 1.2990 (breakeven) when price is at 1.2950 (1.2990-40pips)
  6. Position (D) – set pending SELL STOP order for 0.1 lot at 1.2980 (1.2990-10pips); take profit = 1.2880 (1.2980-100pips); stop loss = 1. 3030; move stop loss to 1.2980 (breakeven) when price is at 1.2940 (1.2980-40pips)
  7. Position (E) – set pending SELL STOP order for 0.1 lot at 1.2970 (1.2980-10pips); take profit = 1.2870 (1.2970-100pips); stop loss = 1. 3030; move stop loss to 1.2970 (breakeven) when price is at 1.2930 (1.2970-40pips)
  8. Position (F) – set pending SELL STOP order for 0.1 lot at 1.2960 (1.2970-10pips); take profit = 1.2860 (1.2960-100pips); stop loss = 1. 3030; move stop loss to 1.2960 (breakeven) when price is at 1.2920 (1.2960-40pips)
  9. Position (G) – set pending SELL STOP order for 0.1 lot at 1.2950 (1.2960-10pips); take profit = 1.2850 (1.2950-100pips); stop loss = 1. 3030; move stop loss to 1.2950 (breakeven) when price is at 1.2910 (1.2950-40pips)

So based on the example above, the pending orders would look like this:

Only after Position (Initial) is executed at 1.3000, then

2 Pending SELL LIMIT orders (A, B) is placed ABOVE 1.3000

5 pending SELL STOP orders (C, D, E, F, G) is placed BELOW 1.3000

 

Not sure if I posted this request in the right place to get max exposure...

Anyway, can some generous coder please take a look at the request above???

I would greatly appreciate it!!!

Many thanks in advance!!!

 

Hello, I think this ea might be what you are looking for.

Check it out it's a bit extended version of your idea. I allowed to put as many trades as you want in 4 directions.

You can find ea bellow in this post, or from this web with full description of the parameters and functionality:

Pending Orders Grid EA | FxCoder – High Quality Financial Programming Services

 
Kalenzo:
Hello, I think this ea might be what you are looking for.

Check it out it's a bit extended version of your idea. I allowed to put as many trades as you want in 4 directions.

You can find ea bellow in this post, or from this web with full description of the parameters and functionality:

Pending Orders Grid EA | FxCoder – High Quality Financial Programming Services

Thank you, Kalenzo, for your response!!! I also replied to you on the other thread...

The EA that you suggested couldn't do what I want...I need to have buy-stop AND buy-limit pending orders (or sell-stop AND sell-limit pending orders) set immediately after PositionInitialPrice is hit...cannot do that with this EA based on its logic illustrated on the website.

Can someone code it for me? PLEASE...

I know that there are people on this site and can code this EA very quickly...but I also know that I'm requesting a free favor from the kindness of strangers...and that people are busy...and that they have different priorities. Thus, all I can do is beg (lol) and hope.

.

 
kokopelli:
Thank you, Kalenzo, for your response!!! I also replied to you on the other thread...

The EA that you suggested couldn't do what I want...I need to have buy-stop AND buy-limit pending orders (or sell-stop AND sell-limit pending orders) set immediately after PositionInitialPrice is hit...cannot do that with this EA based on its logic illustrated on the website.

Can someone code it for me? PLEASE...

I know that there are people on this site and can code this EA very quickly...but I also know that I'm requesting a free favor from the kindness of strangers...and that people are busy...and that they have different priorities. Thus, all I can do is beg (lol) and hope.

.

Hello,

Ok but you didnt wrote that in your prior description so I didnt knew that you wish to have orders set on price hit.

Please clarify this idea a bit.

Lets say that we are right now at price 1.2000

You set PositionInitialPrice = 1.2010, when it will be hit buy stop orders should be set above and sell stop orders should be set bellow this price immediately? Or only buy stop or only sell stop or only sell limit or only buy limit ? I mean - you wish to choose which type of order you would like to execute or ea should figure out this somehow ?

If ea should figure out this somehow then you need to specify condition for stop and limit orders and it can be coded in the ea.

There should be also additional parameter when you want to execute orders "on price hit" - minimumFirstOrderDistance because if you execute pending orders then they need to be in "some" distance from the current ask/bid price. We can also use parameter that we already have: PipIncrementForNextPosition and if it's less than distance allowed by broker ea will enlarge this distance automaticaly for first order, and move initial price a little bit forward to reach broker requirements.

Let me know.

 

Hello Kalenzo,

To answer your inquiries, I'm using my discretionary method to determine whether to go long or short.

1) Let's say my method said...go LONG and I would like PositionInitialPrice = 1.2010

2) Let's say that we are right now at price 1.2000

3) I open this EA and type in PositionInitialPrice = 1.2010 (along with lot size, SL, TP, Increment, Breakeven, etc.)

4) This EA sees that current price PositionInitialPrice, it will place a BUY-LIMIT order)

5) ONLY AFTER PositionInitialPrice is executed...this means that current price is at 1.2010, then this EA will place 2 pending buy orders BELOW 1.2010, and 5 pending buy orders ABOVE 1.2010

6) The 2 pending buy orders BELOW 1.2010 will be BUY-LIMIT orders

7) The 5 pending buy orders ABOVE 1.2010 will be BUY-STOP orders

I hope my explanation above clears things up...simple I hope.

Per your suggestion in your post above: In cases of a price GAP or SPIKE, then it's not a bad idea to have a MinimumOrderDistance parameter (so that if pending condition is hit, but because of GAP/SPIKE, price is not within X-pips of pending order price, then do not execute this pending order).

PLEASE HELP ME WITH THIS...

 

Here's an example if my discretionary method said to go short.

1) Let's say my method said...go SHORT and I would like PositionInitialPrice = 1.2010

2) Let's say that we are right now at price 1.2000

3) I open this EA and type in PositionInitialPrice = 1.2010 (along with lot size, SL, TP, Increment, Breakeven, etc.)

4) This EA sees that current price PositionInitialPrice, it will place a SELL-STOP order)

5) ONLY AFTER PositionInitialPrice is executed...this means that current price is at 1.2010, then this EA will place 2 pending short orders ABOVE 1.2010, and 5 pending short orders BELOW 1.2010

6) The 2 pending short orders ABOVE 1.2010 will be SELL-LIMIT orders

7) The 5 pending short orders BELOW 1.2010 will be SELL-STOP orders

 

Your explenation is clear enough right now. However I'm going out for 3 days today night so I can sit down on this ea in sunday evening.

 
Kalenzo:
Your explenation is clear enough right now. However I'm going out for 3 days today night so I can sit down on this ea in sunday evening.

THANK YOU so much for looking into it, and working on it.

 

contact me i give u the ea.

Reason: