Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


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 03-12-2007, 03: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!
Reply With Quote
  #2 (permalink)  
Old 03-12-2007, 04:07 AM
Senior Member
 
Join Date: Mar 2006
Posts: 787
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!
Reply With Quote
  #3 (permalink)  
Old 03-12-2007, 04: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!
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 On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit Strategy: Stepping Stops vs. Trailing Stops stu Expert Advisors - Metatrader 4 45 07-31-2008 12:18 AM
Tighter Trailing Stops && Stops Nicholishen Expert Advisors - Metatrader 4 25 06-27-2008 01:04 AM
EA -- OrderSend issue SaxMan Metatrader 4 2 02-23-2007 03:00 AM
OrderSend question knili Metatrader 4 5 10-03-2006 12:16 AM
How many parameters can the OrderSend allow? Aaragorn Questions 6 07-17-2006 10:31 PM


All times are GMT. The time now is 02:51 AM.



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