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
  #281 (permalink)  
Old 08-29-2006, 12:27 AM
cja's Avatar
cja cja is online now
Senior Member
 
Join Date: Apr 2006
Posts: 579
cja is on a distinguished road
Refreshing indicator info

Is there any way to have indicator data refresh quicker, sometimes the "Comments" and "separate data windows" take quite some time to update and you have to refresh the chart to get the latest data or is this more an issue with computer setups ? I ask this because a friends laptop seems to update data quicker than my computer.

can "RefreshRates" be used maybe ?

Any help would be greatly appreciated.

I have just found out that it is critical where the Data window code is put - I have now placed the Data code in the right place in the indicator code and it updates fine now. at least that has fixed a problem I was having with two indicators, any other input or ideas would be welcome.

Last edited by cja; 08-29-2006 at 09:22 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #282 (permalink)  
Old 08-29-2006, 06:02 AM
Junior Member
 
Join Date: Aug 2006
Posts: 2
under_snk is on a distinguished road
Hello,

I would like please Kalenzo or another good programmer to help me with this modification please.

My level of knowledge of mql language is basic because I'm just beginning to learn and I need to add a sound alert and popup to an indicator and I still don't find the correct code to do so.

The indicator that I want to modify is the i_trend.mq4, I need to add a sound alert and popup so as when the red line touches the level 0.0002 it shows a SHORT alert and when the green line touches the level 0.0002 it shows a BUY alert. I would need it to send the alerts only when the lines go UPWARDS because if they touch that level when going down it wouldn't be useful.

I took as an example the code of another indicator that shows sound alerts and popup but I can't make this same thing for the i_trend, the sample indicator is the "PerkyAsctrend1.mq4" I an enclosing both indicators to this post as a reference.

I will be very grateful to whoever helps me to add those modifications, thank you very much in advance.

The section of the code in the PerkyAsctrend where the "alert" is written is the following:



if (val2!=0 && up==0 )
{
val1buffer[i]= val2-1*Point;
up=1;
dn=0;
if(shift<=2)
{
Alert (Symbol()," ",Period(),"M Asctrend BUY ");
}
}
if (val1 !=0 && dn==0)
{

val2buffer[i]= val1+1*Point;
dn=1;
up=0;
if(shift<=2)
{
Alert (Symbol()," ",Period(),"M Asctrend SELL ");
}
}


How can I implement this same thing for the i_trend? with the conditions that I specified above.

Thanks again!
Attached Files
File Type: mq4 i_Trend.mq4 (3.3 KB, 28 views)
File Type: mq4 PerkyAsctrend1.mq4 (4.9 KB, 28 views)

Last edited by under_snk; 08-29-2006 at 06:12 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #283 (permalink)  
Old 08-29-2006, 08:52 AM
Junior Member
 
Join Date: Dec 2005
Posts: 4
JN75 is on a distinguished road
Basic Programing

Hello,

I have read through you tutorials and see that you have spent a lot of time and effort into creating them!! But as I am just learning and new to programming I got lost very early on. I am looking into some basic programming classes at a local technical school...I am just wondering if MQL4 is written on the base of another programming language? Or better yet if I had to learn one of the really common programming languages that would make MQL4 easiest, which would it be?

Thank You!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #284 (permalink)  
Old 08-29-2006, 09:19 PM
Member
 
Join Date: Dec 2005
Posts: 58
adria is on a distinguished road
EA problem

I created a simple EA by change MACD Sample EA that is placed at MT4 platform.
The created EA I put in 6 folders and changed the names of that folders.
In every EA in each folder I put the different magic number. I attached
that 6 EAs on the 6 pairs.The problem is that each EA works alone and when
one EA opens any order another EAs can't work in the same time.
Maybe MACD Sample EA has some code that prevents this operation.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #285 (permalink)  
Old 08-29-2006, 09:52 PM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Question Doubletop Checking Coding

In my EA, I wish to check to make sure that the current currency price is above the last 10 bars High before I enter a buy trade. How would I test for this in a MQ4 statement? Thanks in Advance!!


Dave
<><<<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #286 (permalink)  
Old 08-29-2006, 11:28 PM
Member
 
Join Date: Dec 2005
Posts: 71
richx7 is on a distinguished road
Quote:
I am just wondering if MQL4 is written on the base of another programming language? Or better yet if I had to learn one of the really common programming languages that would make MQL4 easiest, which would it be?
MQL4 is based on the C language, so its best to learn C before programming with it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #287 (permalink)  
Old 08-30-2006, 05:34 AM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Smile

Quote:
Originally Posted by Yannis
Dave,
Try changing your code to following snippet and let me know if that did the trick.
Yannis

int i=0;
for (int cnt=OrdersTotal()-1;cnt>=0;cnt--)
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType()>=OP_SELL && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(15 *Point),Bid-(20*Point),Cyan); //Modify stop loss and take profit
return(0);
}

if (OrderType()>=OP_BUY && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(15*Point),Ask+(20*Point),Cyan); //Modify stop loss and take profit
return(0);
}
return(0);
}
}

I have a problem with it always modifing the trades in the backtester over and over. How do I get it to modify the trades once. Since the program is going to sleep, the only trades that need to be modified are any trades still open.

Please see attached .Gif of Backtest results. I am so close to getting this right - Please advise!! I use this Take Profit and Stop Loss modification in conjunction with the sleep mode. Please see code below

int start()
{

if (UseHourTrade)

{
int a=0;
int b=0;
int c=0;

if(!(Hour()>=FromHourTrade1 && Hour()<=ToHourTrade1)) a=1;

if(!(Hour()>=FromHourTrade2 && Hour()<=ToHourTrade2)) b=1;

if(!(Hour()>=FromHourTrade3 && Hour()<=ToHourTrade3)) c=1;

if(a==1 && b==1 && c==1)

{

Comment(
"\n"," * SOLAR WIND EXPERT ADVISOR *",
"\n",
"\n", " - PROGRAM IN SLEEP CYCLE - ",
"\n",
"\n"," > NON-TRADING HOURS! <");

///////////////////MODIFY STOP LOSS & TAKE PROFIT AT START OF SLEEP CYCLE /////////////////
int h=0;

for (int cnt1=OrdersTotal()-1;cnt1>=0;cnt1--)
OrderSelect(h, SELECT_BY_POS, MODE_TRADES);
if (OrderType()>=OP_SELL && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(15 *Point),Bid-(20*Point),Cyan); //Modify stop loss and take profit
return(0);
}

if (OrderType()>=OP_BUY && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(15*Point),Ask+(20*Point),Cyan); //Modify stop loss and take profit
return(0);
}
return(0);
}
}

Dave
<><<<

PLEASE LOOK AT ATTACHED THUMBNAIL!
Attached Images
File Type: gif modifying sl and tp on open trades..gif (59.7 KB, 188 views)

Last edited by iscuba11; 08-30-2006 at 05:48 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #288 (permalink)  
Old 08-30-2006, 05:42 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 289
phoenix is on a distinguished road
Quote:
Originally Posted by iscuba11
I have a problem with it always modifing the trades in the backtester over and over. How do I get it to modify the trades once. Since the program is going to sleep, the only trades that need to be modified are any trades still open.

Please see attached .Gif of Backtest results. I am so close to getting this right - Please advise!! I use this Take Profit and Stop Loss modification in conjunction with the sleep mode. Please see code below

int start()
{

if (UseHourTrade)

{
int a=0;
int b=0;
int c=0;

if(!(Hour()>=FromHourTrade1 && Hour()<=ToHourTrade1)) a=1;

if(!(Hour()>=FromHourTrade2 && Hour()<=ToHourTrade2)) b=1;

if(!(Hour()>=FromHourTrade3 && Hour()<=ToHourTrade3)) c=1;

if(a==1 && b==1 && c==1)

{

Comment(
"\n"," * SOLAR WIND EXPERT ADVISOR *",
"\n",
"\n", " - PROGRAM IN SLEEP CYCLE - ",
"\n",
"\n"," > NON-TRADING HOURS! <");

///////////////////MODIFY STOP LOSS & TAKE PROFIT AT START OF SLEEP CYCLE /////////////////
int h=0;

for (int cnt1=OrdersTotal()-1;cnt1>=0;cnt1--)
OrderSelect(h, SELECT_BY_POS, MODE_TRADES);
if (OrderType()>=OP_SELL && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+(15 *Point),Bid-(20*Point),Cyan); //Modify stop loss and take profit
return(0);
}

if (OrderType()>=OP_BUY && OrderSymbol()==Symbol() && (OrderMagicNumber () == MagicNumber || MagicNumber==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-(15*Point),Ask+(20*Point),Cyan); //Modify stop loss and take profit
return(0);
}
return(0);
}
}

Dave
<><<<
your OrderSelect() did not count base on the running loop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #289 (permalink)  
Old 08-30-2006, 05:58 AM
iscuba11's Avatar
Senior Member
 
Join Date: May 2006
Location: Houston
Posts: 399
iscuba11 is on a distinguished road
Question

Do not understand. How do I correct this error?? Maybe I do see - Let me change cnt1 to h. Am I correct?

Dave
<><<

Last edited by iscuba11; 08-30-2006 at 06:01 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #290 (permalink)  
Old 08-30-2006, 06:01 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 289
phoenix is on a distinguished road
for (int cnt1=OrdersTotal()-1;cnt1>=0;cnt1--)
OrderSelect(cnt1, SELECT_BY_POS, MODE_TRADES);

make it counts the same number
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 04:20 AM.



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