Forex



Go Back   Forex Trading > Discussion Areas > Metatrader 4
Forex Forum Register More recent Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-22-2007, 06: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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 02-24-2007, 11: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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 02-25-2007, 12:05 PM
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!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 07:16 AM
Script to close open orders... babarmughal Expert Advisors - Metatrader 4 1 12-13-2006 05:50 PM
Using Arrays to track info for All Open Orders deeforex Questions 6 09-12-2006 07: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 05:17 AM
Minimum Distance between market prices and limit price Maji Metatrader 4 2 05-02-2006 04:30 PM


All times are GMT. The time now is 08:32 AM.



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