Order Entry Logic

 

Could someone share some order entry logic with me?

If my ea logic says it's time to buy, I don't want my ea to execute the buy order if the price is still dropping. I want it to allow the price to drop, and enter on a reversal.

for example: ea says enter at 1.45500 but price continues to drop to 1.45000. when the price goes back up to 1.45025 that's when I want it to enter the buy.

Kind of like a trailing stop, but only on the order entry side.

Any pointers would be greatly appreciated... Thanks.

 

Can you please define what you mean by "reversal" . . . and no it's not a stupid question. Define it and then you have your logic to use to build your code.

Alternatively just use a limit buy at 1.45025 . . but that won't work out too well . . . as you will see if you test it.

 
RaptorUK:

Can you please define what you mean by "reversal" . . . and no it's not a stupid question. Define it and then you have your logic to use to build your code.

Alternatively just use a limit buy at 1.45025 . . but that won't work out too well . . . as you will see if you test it.


I'm currently using several standard indicators to tell me when to enter an order... and for the most part it's highly accurate.

So, if I get the buy indicator, and the price keeps falling, I expect a "reversal" at least large enough for my purposes to be when the price moves in the up direction by X pips. And X could be different depending on the chart time frame. On the H1 I'm playing with 0.00150 and that seems visually to do what I need...

I don't know how to use a limit buy if I don't know what the lowest point will be before it bounces up by 0.00150. Thats the help I need in coding this.

 
Assuming you have a buy signal, wait until Bid >= LL + 15 pips and open. LL = Low[ iLowest(...) ] over multiple bars.
 
WHRoeder:
Assuming you have a buy signal, wait until Bid >= LL + 15 pips and open. LL = Low[ iLowest(...) ] over multiple bars.

I think I'm dense... this is what I have tried, but it's not doing what I want. the following is a resultant sell order... but it should have taken the sell much sooner.

no. date time type # size entry price S/L T/P Swap Balance

11 2011.08.05 18:58 sell 6 0.45 1.42493 0.00000 1.42393 0.00 688.00 <----------- this is the order.

I'm doing this on the H1 if you want to look at the order. the top of the bar is 1.42850 (or close to) which should execute the order at 1.42700 (or close to)

Is it the MODE_HIGH that I'm using that make it wrong? Is it averaging the last 3 bar's highs?


      double HH=High[iHighest(NULL,0,MODE_HIGH,3,0)];

      if(sell.trigger == 1 &&  Bid < HH-0.00150) {
       ticket = OrderSend(Symbol(),OP_SELL,lot.size.1,Bid,3,0,Bid-0.001,"BBand 1 Sell",255,0,CLR_NONE);}
Reason: