
05-07-2008, 05:35 AM
|
|
Senior Member
|
|
Join Date: Feb 2006
Posts: 519
|
|
Quote:
Originally Posted by mastoto
Hi folks,
I made an EA that calculates daily hi-low between some period, and then place pending orders buystop/sellstop, that will expired in 12 hours.
I run it in GBP-JPY pair (8 pips spread in my broker)
Code:
int ticket, SL, TP; //SL= StopLoss , TP= TakeProfit
int Spacing = 10; // Spacing Pips
double vAsk = HighestPrice+Spacing*Point; // raise/lower 10 pips for OP Buystop/Sellstop , HighestPrice= some highest price
ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,vAsk,0,vAsk-SL*Point,vAsk+TP*Point,"Pending Order BUY STOP",20070125,CurTime() + 12 * 3600,Green);
The result, Pending Order Buy Stop was executed, even price did not touch it. I have traced the OP Buy Stop, placed at price 204.08, but it was executed when the price is at 204.00. It seems that Spread factor is involved.
My friend told me that manual Pending Order Buystop/Sellstop is executed without spread factor, but why it's different with placing order by EA ?
So is there any mistakes in my code ?
Thanks in advance.
|
If your "HighestPrice" is a BID price as they are on all charts, you probably have to add the spread. Any BUY order is triggered by a ASK price.
|