Forex
Google
New signals service!

Go Back   Forex Trading > Discussion Areas > Metatrader 4


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-22-2007, 05:30 PM
Junior Member
 
Join Date: Jan 2007
Posts: 26
echnaton is on a distinguished road
Too much distance from real price in Open Orders

Hello,

I have a problem with to much distance in open Order with the OrderSend() function.

Here a picture:



Often there are taken prices 3 pips over the visible bars in the chart.

Here ist my Code to open Orders:
PHP Code:
//my parameters
extern double    TakeProfit=60.0;
extern double    Lots=0.01;
extern double    TrailingStop=35.0
extern double    StopLoss=100.0;
 
extern int Slippage=3;
 
if(
isCrossed == 1)
   {
      while(
true)
      {
      
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,"EMA_Cross_2",MAGIC,0,Green);
         if(
ticket<=0)
         {
         
eror=GetLastError();
         Print(
"Error opening BUY order without RefreshRates() function in if not ExistPosition() Abfrage error: ",ErrorDescription(eror));         
 
         
RefreshRates();
 
         
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,"EMA_Cross_2",MAGIC,0,Green);
 
         
eror=GetLastError();
         Print(
"Error opening BUY order after RefreshRates() function in if not ExistPosition() Abfrage error: ",ErrorDescription(eror));         
         
         } 
         else 
         {
         if(
OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) 
         Print(
"BUY order opened : ",OrderOpenPrice());
         break;
         }
         
      }
//-> End while 
   
return(0);//-> End start() 
   
}//-> End if is Crossed==1 
Can you their give me please tips what to do for get reasonable praises ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-24-2007, 10:18 PM
Junior Member
 
Join Date: Apr 2006
Posts: 13
Mark53 is on a distinguished road
Hi,

That's normal, when you place a BUY order, you buy at the ask price, which includes a commission. It depends of the broker and seems to be 3 pips in your case (you can get it by calling the OrderCommission() function). Since the charts usually represent bid prices, you buy at ask = bid + 3 pips.

By the way, you should write :

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,Bid-StopLoss*Point,Bid+TakeProfit*Point,"EMA_Cross_2",MAGIC,0,Green);

since you sell at the bid price.

Regards,
Mark
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-25-2007, 11:05 AM
Junior Member
 
Join Date: Jan 2007
Posts: 26
echnaton is on a distinguished road
Hello Mark,

thank you very much for helping with your tips.

Since I have think that a Buy Order must be made with the Aks Price, but now because you say that I can use the Bid price to for OrderSend() function, I will test it, thank you for the tip.

Regadrs
Echi
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
close all open orders script forextrend General Discussion 2 12-17-2006 06:16 AM
Script to close open orders... babarmughal Expert Advisors - Metatrader 4 1 12-13-2006 04:50 PM
Using Arrays to track info for All Open Orders deeforex Questions 6 09-12-2006 06:01 PM
how to get the real server time or how to tell if the market is open theimperialone General Discussion 3 06-24-2006 04:17 AM
Minimum Distance between market prices and limit price Maji Metatrader 4 2 05-02-2006 03:30 PM


All times are GMT. The time now is 01:18 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.