Forex
Google
New signals service!

Go Back   Forex Trading > Downloads > Expert Advisors - 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 10-27-2006, 09:47 PM
Aaragorn's Avatar
Senior Member
 
Join Date: Jun 2006
Location: USA
Posts: 801
Aaragorn is on a distinguished road
A Little help coding please???

Ok, I think you can see what I'm trying to do here....

I want to record to the journal when a trade loses....

So I pop this little function in just before the order closes...




PHP Code:

RecordLongOutcomes
();
OrderClose(OrderTicket(),OrderLots(),Bid ,SlipPage,Violet); // We close the order                          
return(0); 
Trouble is that it's not Printing....

In fact when the tester hit's a stop loss it doesn't care about this code and it just closes....


PHP Code:
/////////////record outcomes/////////////////
void RecordLongOutcomes()
{

      if(
Bid<OrderOpenPrice())
         {
         
OrderSelect(OrderTicket(),SELECT_BY_POS,MODE_TRADES);
         Print(
" Loser Long ",OrderTicket()," Opened: ",OrderOpenPrice(),"  Closed: "Bid);
         }

      return (
0);

So How do I get this data to trigger on the close and print to the journal?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-28-2006, 07:01 PM
Member
 
Join Date: Nov 2005
Posts: 49
4xCoder is on a distinguished road
You have to call OrderSelect before calling OrderTicket. Your code should look something like the following.

int ticket = OrderSend(....); // Must save ticket from the order send


if ( OrderSelect (ticket,SELECT_BY_POS,MODE_TRADES) ) {
RecordLongOutcomes();
OrderClose(OrderTicket(),OrderLots(),Bid ,SlipPage,Violet); // We close the order
}
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
Coding help please mj_bolt Indicators - Metatrader 4 2 05-07-2007 10:39 AM
Help with Coding Please hoosain Questions 1 08-01-2006 05:36 PM
EA Coding Help! WAW Questions 0 05-03-2006 05:12 AM
Coding Help jerrymar Indicators - Metatrader 4 1 03-23-2006 09:20 AM
Need help coding jdsim1 Suggestions for Trading Systems 4 03-19-2006 10:40 PM


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



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