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
  #21 (permalink)  
Old 07-13-2007, 03:45 AM
Member
 
Join Date: Feb 2006
Location: malaysia
Posts: 44
dreamer is on a distinguished road
thank bro for the code...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #22 (permalink)  
Old 07-13-2007, 07:13 AM
Junior Member
 
Join Date: Jun 2007
Posts: 2
Sagittarius is on a distinguished road
Hi
I want to ask how to make continous expert? so I can save the state of the expert before stop and run it again from the same point when I start it again.
Thanks for the answer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #23 (permalink)  
Old 12-19-2007, 10:21 PM
Junior Member
 
Join Date: Nov 2007
Posts: 18
weetikveel is on a distinguished road
Help plz?

Hi, could someone tell me how to prevent my EA from opening up more than one order at the same time (at one pair)?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #24 (permalink)  
Old 12-20-2007, 12:33 AM
Member
 
Join Date: Nov 2006
Posts: 94
tiger_wong is on a distinguished road
Quote:
Originally Posted by weetikveel View Post
Hi, could someone tell me how to prevent my EA from opening up more than one order at the same time (at one pair)?
Usually I put this logic in the beginning of int start() section:

int start()

if (OrdersTotal() > 0) return(0);

//-----Your EA begin here---------


This is the simplest way to prevent your EA for opening more than one order at same time. You can find other advanced logics at this forum.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #25 (permalink)  
Old 12-20-2007, 06:42 AM
Junior Member
 
Join Date: May 2007
Posts: 12
eastcity is on a distinguished road
Alerts

I thought I could limit the number of alerts triggered by trigger using this:

extern int MaxWaiting_sec = 30;



if(trigger == 1)
{
int StartWaitingTime = GetTickCount();
if(GetTickCount() - StartWaitingTime > MaxWaiting_sec * 1000)
{

if(ShowAlert == true) {

Alert("Buy...........


But it does not seem to work, what am I doing wrong??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #26 (permalink)  
Old 12-20-2007, 07:38 AM
Senior Member
 
Join Date: Sep 2006
Posts: 110
chawichsak is on a distinguished road
BE stop

Hello.
Could someone add BE stop to this EA please.
Thank in advance.
Cha.

e-TrendManager.mq4
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #27 (permalink)  
Old 12-23-2007, 06:40 AM
Junior Member
 
Join Date: Dec 2007
Posts: 2
gsilverl is on a distinguished road
How do you code the current price on the indicator?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #28 (permalink)  
Old 01-21-2008, 09:06 PM
Junior Member
 
Join Date: Jan 2008
Location: Brooklyn
Posts: 22
bdht is on a distinguished road
EA question

Hello there,
Question:
I have started coding my EA. I am by no means a decent coder for MQL b/c I've never seen C++/C. Fine.

My settings are as follows: There are two indicators: IND1 [indicator] and IND2. IND1 has 1 line, IND2 has 2 lines. Lines = lines on a chart. For instance, Bollinger bands indicator has 3 lines, but isn't used in this example. Both INDs have their 0.0 level shown on the chart.

My logic is as follows: when IND1 crosses its 0 level the first time and goes into negative, send the SELL order. Wait for the IND2 to have its line1 cross line2 and send the BUY order, automatically closing the SELL submitted by IND1. If there's a 2nd/3rd/etc 0 level crossing by IND1 into either positive or negative before the BUY, disregard that crossing, do nothing and proceed w/ that first SELL order[otherwise there will be a 2nd/3rd/etc SELL order w/ no corresponding BUY order]. When the BUY order is executed by the IND2 [IND2's line1 has crossed line2], wait for the following crossing of 0 [into the negative] by IND1 and send the SELL order, automatically closing the BUY order submitted by IND2.
I'm going to include my coding. Please take a look at it, b/c it isn't graphing anything and isn't working.

Here's the code itself:

Code:
#property copyright "Copyright © 2008 BDHT"
#define MAGIC 689

//do not take into consideration
//the names of the indicators
//they're fabricated

extern double lots = 0.1; // Lots
extern double TP = 140; // Take Profit
extern double SL = 30; // Stop Loss
static int prevtime = 0;
static int res = 0;
double IND2_line1, IND2_line2, IND1, IND1_prev, IND2_line1_prev;

int init() {  
   IND2_line1 = iIND2_line1(NULL,0,0,MODE_MAIN,0);
   IND2_line2 = iIND2_line2(NULL,0,0,MODE_SIGNAL,0);
   IND1= iCustom(NULL, 0, "IND1", 0, 0, 0);
   IND1_prev= iCustom(NULL,0, "IND1", 0, 0, 1);
   IND2_line1_prev = iCustom(NULL, 0, "IND2", 0, 0, 1);
   return(0);
}
int deinit() {
   return(0);
}

int start() {
//Make sure there are no open orders; if yes - stop
if (OrdersTotal() > 0) 
      return (0);
      
if (IND1< 0 && IND1 < IND1_prev && IND1_prev > 70 && IND2_line1 < 0 && IND2_line2 < 0) { 
// 70 may be 10; simply means that the IND1_prev was greater than 0
      res=OrderSend(Symbol(),OP_SELL,lots,Bid,3,Bid+SL*Point,Ask+TP*Point,"My EA",MAGIC,0,Blue);
      return(0);
}
if (IND2_line1 > IND2_line2 && IND2_line1_prev < IND2_line1) {
      res=OrderSend(Symbol(),OP_BUY,lots,Ask,3,Ask+SL*Point,Bid+TP*Point,"My EA",MAGIC,0,Blue);
      return(0);
}
I know I'm missing something... But what is it?

UPDATE: Okay, I got a little help from phy in MQL forums: he says that "code within start() executes every tick" and "code within init() is only executed one time or once per intitialization/start/restart of the EA". Am I getting this correctly: a tick is any change of price. A bar has many ticks. A M1 bar may have 60 seconds [or so] worth of ticks and a M5 bar may have 60 seconds * 5 instances/minutes worth of ticks. I do not want the code to pay attention to each and every tick there is; I just want the bar to make the difference.

Last edited by bdht; 01-22-2008 at 04:11 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #29 (permalink)  
Old 01-23-2008, 02:45 AM
Junior Member
 
Join Date: Apr 2007
Posts: 3
Nelson7 is on a distinguished road
Continuous alerting

I was wondering what code and where to add it, if I want any indicator to sound, email, alert until I shut it off. I'm away from my computer at times and use text messages and sound to alert me whether awake or asleep. One sound or text message is not always enough to get my attention.

Thank you ahead of time
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #30 (permalink)  
Old 01-23-2008, 11:24 PM
Linuxser's Avatar
Moderator
 
Join Date: May 2006
Location: Helliconia (Spring)
Posts: 2,821
Blog Entries: 34
Linuxser has disabled reputation
Quote:
Originally Posted by Nelson7 View Post
I was wondering what code and where to add it, if I want any indicator to sound, email, alert until I shut it off. I'm away from my computer at times and use text messages and sound to alert me whether awake or asleep. One sound or text message is not always enough to get my attention.

Thank you ahead of time
You could take a look at our thread Indicators with alert signals to get good examples.

There is another good thread here and here
__________________
Elite Manual Trading | Portfolio | Calendar | Suggestions to improve the forum | My Blog

Remember: Signatures must have three lines as maximum
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 Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MT4 (Basic) Questions stepwise Metatrader 4 6 09-22-2008 02:22 AM
Basic Indicator Question waaustin Metatrader Programming 8 04-02-2008 02:54 PM
Need Help Understanding Basic MQL logic Emerald King Expert Advisors - Metatrader 4 7 02-27-2007 09:59 AM
Very basic coding help needed camisa Questions 1 05-08-2006 05:36 PM


All times are GMT. The time now is 07:39 PM.



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