Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register More recent Blogs 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 03-12-2007, 05:53 AM
Junior Member
 
Join Date: Oct 2006
Posts: 2
Pertti is on a distinguished road
Question OrderSend and stops

i'm trying to write my own EA, but ran into confusion

extern double TakeProfit=25.0;
extern double StopLoss=20.0;
extern double Lots=0.1;


ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,Stop Loss,Bid-TakeProfit*Point,"pip-catcher SHORT",12345,0,Red);

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,StopL oss,Ask+TakeProfit*Point,"pip-catcher LONG",12345,0,Green);

To me, it looks allright, but when i run it on StrategyTester 1H EUR/USD Open Prices only. When it try's to open position, it shows error - invalid stops means that stoploss and takeprofit are wrong? When i change those something else(bigger,smaller) or writing number out insteed of Stoploss or TakeProfit inside OrderSend, but still the same invalid stops any help, i'm getting angry against MQL4 already
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 03-12-2007, 06:07 AM
Senior Member
 
Join Date: Mar 2006
Posts: 793
Maji is on a distinguished road
Try this:


ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,Bid+StopLoss*Point, Bid-TakeProfit*Point,"pip-catcher SHORT",12345,0,Red);

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10, Ask-StopLoss*Point, Ask+TakeProfit*Point,"pip-catcher LONG",12345,0,Green);




Quote:
Originally Posted by Pertti
i'm trying to write my own EA, but ran into confusion

extern double TakeProfit=25.0;
extern double StopLoss=20.0;
extern double Lots=0.1;


ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,Stop Loss,Bid-TakeProfit*Point,"pip-catcher SHORT",12345,0,Red);

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,StopL oss,Ask+TakeProfit*Point,"pip-catcher LONG",12345,0,Green);

To me, it looks allright, but when i run it on StrategyTester 1H EUR/USD Open Prices only. When it try's to open position, it shows error - invalid stops means that stoploss and takeprofit are wrong? When i change those something else(bigger,smaller) or writing number out insteed of Stoploss or TakeProfit inside OrderSend, but still the same invalid stops any help, i'm getting angry against MQL4 already
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 03-12-2007, 06:47 AM
Junior Member
 
Join Date: Oct 2006
Posts: 2
Pertti is on a distinguished road
Actually it still keeps giving invalid stops on every order

but i chanced these to

ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+0 .0020,Bid-0.0030,"pip-catcher SHORT",12345,0,Red);
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-0.0020,Ask+0.0030,"pip-catcher LONG",12345,0,Green);

and seems that this way works, theoreticaly that should be same
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

Tags
ordersend


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
Exit Strategy: Stepping Stops vs. Trailing Stops stu Expert Advisors - Metatrader 4 66 11-01-2009 09:13 PM
Tighter Trailing Stops && Stops Nicholishen Expert Advisors - Metatrader 4 34 04-09-2009 08:11 AM
EA -- OrderSend issue SaxMan Metatrader 4 2 02-23-2007 04:00 AM
OrderSend question knili Metatrader 4 5 10-03-2006 01:16 AM
How many parameters can the OrderSend allow? Aaragorn Questions 6 07-17-2006 11:31 PM


All times are GMT. The time now is 06:47 PM.



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