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 (2) Thread Tools Display Modes
  #731 (permalink)  
Old 08-05-2007, 10:29 PM
Senior Member
 
Join Date: Dec 2006
Posts: 112
homestudy is on a distinguished road
Why isn't this in the EA Section

This is about EA's and should be in the EA section.
Thanks ND for the move

Last edited by homestudy; 08-05-2007 at 11:10 PM. Reason: thread moved
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #732 (permalink)  
Old 08-06-2007, 12:28 PM
Member
 
Join Date: May 2006
Posts: 32
veematics is on a distinguished road
Detect the last result

Hello,
I create an EA.. i want to detect my last profitable/loss closed order, is this possible to accomplish ?

Thanks

Vic
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #733 (permalink)  
Old 08-06-2007, 12:45 PM
Senior Member
 
Join Date: Feb 2006
Posts: 559
Michel is on a distinguished road
Quote:
Originally Posted by veematics View Post
Hello,
I create an EA.. i want to detect my last profitable/loss closed order, is this possible to accomplish ?

Thanks

Vic
Look at here: How do you determine order close reasons?

Edit: Sorry, this does not answer your question.
Yes, it is possible, here is a example code:
PHP Code:
datetime LastProfit=0LastLoss=0;   
for(
int i HistoryTotal() - 1>= --)
{
      if(!
OrderSelect(iSELECT_BY_POS)) continue;
      if(
OrderSymbol() != Symbol()) continue;
      if(
OrderMagicNumber() != Magic) continue;
      if(
OrderCloseTime() > LastProfit && OrderProfit() >= 0)
      {
            
LastProfit OrderCloseTime();
            
LastProfitTicket OrderTicket();
      }
      if(
OrderCloseTime() > LastLoss && OrderProfit() < 0)
      {
            
LastLoss OrderCloseTime();
            
LastLossTicket OrderTicket();
      }
}
// Now do what you want with both tickets 

Last edited by Michel; 08-06-2007 at 12:56 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #734 (permalink)  
Old 08-07-2007, 05:46 AM
Junior Member
 
Join Date: Jul 2007
Posts: 3
Benjimang is on a distinguished road
Quote:
Originally Posted by Benjimang View Post
Hi everyone!

I have used the Expert Advisor Builder at sufx.com to create an EA. It has two limitations that I am trying to get rid of:

1. only opens 1 trade at a time. I can get it to have two trades open at once, but I can't get it to open a buy order and a sell order simultaneously.

2. seems to take sell orders as a preference over buy orders. This wouldn't really be an issue if problem number 1 was solved.

Here is the peice of code that seems to be holding me up:

Code:
   //Check position
   bool IsTrade = False;
   
   for (int i = 0; i < Total; i ++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) {
            IsTrade = True;
      if (OrderType() == OP_BUY) {
            //Close
Any suggestions? I'd like to let it open as many trades as possible, and be able to open buy and sell orders simultaneously if the indicators say so.

Cheers for the help,
Benjimang
PLEASE, does ANYONE know what to do with the above code? Have I identified the right piece of code here? Surely someone must know something...?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #735 (permalink)  
Old 08-07-2007, 08:30 AM
Senior Member
 
Join Date: Feb 2006
Posts: 559
Michel is on a distinguished road
Quote:
Originally Posted by Benjimang View Post
PLEASE, does ANYONE know what to do with the above code? Have I identified the right piece of code here? Surely someone must know something...?
This is wrong, both buy orders and sell orders are mixed :
PHP Code:
      if (OrderType() <= OP_SELL &&  OrderSymbol() == Symbol()) {
            
IsTrade True
You should have something like this :
PHP Code:
bool IsSellTrade false;
bool IsBuyTrade false;
for(...
 ...
 if (
OrderType() == OP_SELLIsSellTrade true;
 if (
OrderType() == OP_BuyIsBuyTrade true
Of course when you test to open a trade, you must test separately IsSellTrade and IsBuyTrade.

Last edited by Michel; 08-07-2007 at 11:14 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #736 (permalink)  
Old 08-07-2007, 02:30 PM
WNW's Avatar
WNW WNW is offline
Senior Member
 
Join Date: Feb 2006
Location: Motown, USA
Posts: 386
WNW is on a distinguished road
Security - Encoding Account Number

I want to run my EAs from a VPS.
For security purposes I want to encode my brokerage account number and upload the compiled version.

Can someone please describe the code to add?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #737 (permalink)  
Old 08-07-2007, 03:25 PM
Administrator
 
Join Date: Sep 2005
Posts: 16,815
Blog Entries: 145
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
Quote:
Originally Posted by WNW View Post
I want to run my EAs from a VPS.
For security purposes I want to encode my brokerage account number and upload the compiled version.

Can someone please describe the code to add?

Thanks.
The code is here (on the first page of this thread How to LOCK/Encrypt EA ).
Besides there is EA in elite section with account protection coded.

Quote:
1. MA_ExpertProfit.mq4: it is the same EA but it will close the orders in s/l or t/p only.

2. MA_ExpertProfit_all.mq4: it will close the order on s/l or t/p, or on the other crossing signal. This EA should work on particular account only. Just change the line "int Account = 111111;" to your account number inside the code. For example your account is 1235463. So this line should be like this:
int Account = 1235463;

3. MA_ExpertProfit_noacc.mq4: it is the same with item # 2. But without any account and it may work in any account (i mean account in Metatrader).
If you are not elite member so I may post the codes here but it is very well-known subject described here in public: How to LOCK/Encrypt EA

More difficult is to create the licence number, set the broker,
Code:
UserVerification(Confirmed)
and so on.
As I know some coders are very professional with this priotecting issues so you may see them from this thread How to LOCK/Encrypt EA

Last edited by newdigital; 08-07-2007 at 03:30 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #738 (permalink)  
Old 08-10-2007, 01:54 AM
1Dave7's Avatar
Member
 
Join Date: Aug 2007
Posts: 82
1Dave7 is on a distinguished road
Smile Magic Number

PHP Code:
int j,totalbuy;

totalbuy=OrdersTotal();
         
for(
j=0;j<totalbuy;j++)

OrderSelect(jSELECT_BY_POSMODE_TRADES);

if(
OrderType()==OP_BUY && OrderSymbol()==Symbol())

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); 

return(
0);
  


How do you reference the magic number in the above close. Likewise, in a order to buy?? Thank you in advance for responding!

Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #739 (permalink)  
Old 08-10-2007, 09:25 AM
Senior Member
 
Join Date: Feb 2006
Posts: 559
Michel is on a distinguished road
PHP Code:
int j,totalbuy;

totalbuy=OrdersTotal();
         
for(
j=0;j<totalbuy;j++)

OrderSelect(jSELECT_BY_POSMODE_TRADES);

if(
OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Magic)

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet); 

return(
0);
  

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #740 (permalink)  
Old 08-11-2007, 11:43 PM
1Dave7's Avatar
Member
 
Join Date: Aug 2007
Posts: 82
1Dave7 is on a distinguished road
Smile

Thanks for responding!!

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

Bookmarks

Tags
histogram, forex, ZUP_v1.mq4

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

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/questions/270-ask.html
Posted By For Type Date
OzFx System:) - Page 639 This thread Refback 06-21-2008 10:53 PM
Forex SRDC Sidus Sibkis EA MT4 Forum OTCSmart This thread Refback 12-08-2007 12:46 PM


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



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