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
  #891 (permalink)  
Old 12-14-2007, 11:54 AM
Junior Member
 
Join Date: Nov 2007
Posts: 15
irclay is on a distinguished road
Hello

How's everybody doing? I'm programming som simple things in MQL4, and i've a question about iBarShift

The documentation defines it like this:

Quote:
Search for bar by open time. The function returns bar shift with the open time specified. If the bar having the specified open time is missing, the function will return -1 or the nearest bar shift depending on the exact.

I'm sorry, i didn't get that. Is it refering to the time the bar opened? E.g the open price of the bar that opened 7.30 for example?
I've got this line:

i4h=iBarShift(NULL,PERIOD_H4,iTime(NULL,0,i),true) +1; but i'm not sure exactly what it does. Anyone care to help

Last edited by irclay; 12-16-2007 at 10:03 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #892 (permalink)  
Old 12-14-2007, 01:14 PM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 280
ralph.ronnquist is on a distinguished road
As I understand it, iBarShift finds you the index of the latest bar with its open time at or before the given time. That's with last argument "false". With last argument "true", the given time must hit the open time exactly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #893 (permalink)  
Old 12-17-2007, 06:29 PM
Member
 
Join Date: Dec 2007
Posts: 38
badawais is on a distinguished road
how do i receive an alert when ever a trade is made?

I want to receive alerts, like the alerts that all windows close and there is a message box, when ever a trade is made. Even if I make a trade on any other computer, like at work, it should tell me on my home computer that a trade has been made along with all its details. Can this be done???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #894 (permalink)  
Old 12-17-2007, 07:03 PM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Smile RefreshRates()

Could this function be used to refresh a repainting indicator automatically within the program without readding the indicator manually to the graph?? If so, could you provide an example of how to code it?

Dave

I do not understand how this function operates?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #895 (permalink)  
Old 12-19-2007, 04:26 AM
Senior Member
 
Join Date: Sep 2006
Posts: 110
chawichsak is on a distinguished road
Need help

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
  #896 (permalink)  
Old 12-21-2007, 05:38 PM
Junior Member
 
Join Date: Jun 2007
Posts: 11
stevex33 is on a distinguished road
Hi guys,
I've got a question.

I'd like to learn to write my own indicators, but I don't really have any idea where I should start.
I've got an idea in my head and the basics of how it should work, but I need a little help.

I've like to create an indicator that shows the average high that a currency moves from the open every day, the same for the low and the same for the close.

So they would all be the distance from the open of the day in terms of pips.
I'd like the user the be able to specify over how many days he wants to calculate that average.

So it would be something like lines drawn in the current days bar to represent the average high, low and close of the currency over x days, and it should keep the lines drawn on the chart.

I tried using the moving average indicator as a baseline to start from, but it all looks pretty confusing. Can someone simplify it for me by breaking it all down into what I should be adding/deleting and where please?

regards
steve

Last edited by stevex33; 12-21-2007 at 05:45 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #897 (permalink)  
Old 12-21-2007, 10:17 PM
Beno's Avatar
Senior Member
 
Join Date: Aug 2006
Location: London
Posts: 361
Beno is on a distinguished road
Help with ordersend comments please

Need some help please I have an EA that has 4 different entry criteria and would like to be able to have a comment in ordersend to let me know which entry criteria was met for any particular position. i have been trying to get this to work but all I seem to be able to do is have a list ie long1,long2,long3 etc. I know that I need to do something different to what I am currently doing but can think of what it might be. I have attached a version of the EA that I am using to experiment with. so any help in solving this would be great. Below is what I am currently seeing.

2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Error opening BUY order : invalid function parameter value
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long4 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long3 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long2 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long1 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Short4 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Short3 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Short2 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Short1 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: invalid lots amount for OrderSend function
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long4 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long3 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long2 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Long1 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Short4 signal taken
2007.12.21 21:57:22 euroform V 2.1-exp EURJPY,H1: Short3 signal taken

Cheers

Beno
Attached Files
File Type: mq4 euroform V 2.1-exp.mq4 (23.6 KB, 6 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #898 (permalink)  
Old 12-24-2007, 06:01 PM
Junior Member
 
Join Date: Sep 2007
Posts: 23
Sendra is on a distinguished road
Quote:
Originally Posted by stevex33 View Post
Hi guys,
I've got a question.

I'd like to learn to write my own indicators, but I don't really have any idea where I should start.
I've got an idea in my head and the basics of how it should work, but I need a little help.

I've like to create an indicator that shows the average high that a currency moves from the open every day, the same for the low and the same for the close.

So they would all be the distance from the open of the day in terms of pips.
I'd like the user the be able to specify over how many days he wants to calculate that average.

So it would be something like lines drawn in the current days bar to represent the average high, low and close of the currency over x days, and it should keep the lines drawn on the chart.

I tried using the moving average indicator as a baseline to start from, but it all looks pretty confusing. Can someone simplify it for me by breaking it all down into what I should be adding/deleting and where please?

regards
steve

Start at the beginning, i.e: learn MQL4. Download e-books by CodersGuru, print them if you are like me---not good at reading something from the screen, then read them.

Read them again if you don't understand the first time.

Do the practice.

if you still don't understand, check out as many EA as possible, see if there's any similiraties with yours. Look for explanation of each line in CodersGuru book, then try to write your own.

You may take some times to write your basic EA, but once you did, honing them is a matter of trying and keep trying.

good luck.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #899 (permalink)  
Old 12-26-2007, 06:24 AM
Junior Member
 
Join Date: Sep 2007
Posts: 23
Sendra is on a distinguished road
what's wrong with these?

Hey, guys

My EA at first based its profit taking from trailing-stop. Then I add some fibo point and start trailing after the last fibo point is reached. But strategy-tester won't work with the latest development. Please help me find my own mistake in the following program.

Thank you.

Quote:
void CheckForTrailing()
{
double highest = High[iHighest(Symbol(),PERIOD_H1,MODE_HIGH,p,0)];
double lowest = Low[iLowest(Symbol(),PERIOD_H1,MODE_LOW,p,0)];
double p1u = NormalizeDouble((OrderOpenPrice()-lowest)*0.618,4);
double tpb1 = p1u*10000;
double p1d = NormalizeDouble((highest-OrderOpenPrice())*0.618,4);
double tps1 = p1d*10000;
double p2u = NormalizeDouble((OrderOpenPrice()-lowest)*1,4);
double tpb2 = p2u*10000;
double p2d = NormalizeDouble((highest-OrderOpenPrice())*1,4);
double tps2 = p2d*10000;
double p3u = NormalizeDouble((OrderOpenPrice()-lowest)*1.618,4);
double tpb3 = p3u*10000;
double p3d = NormalizeDouble((highest-OrderOpenPrice())*1.618,4);
double tps3 = p3d*10000;
double p4u = NormalizeDouble((OrderOpenPrice()-lowest)*2.382,4);
double tpb4 = p4u*10000;
double p4d = NormalizeDouble((highest-OrderOpenPrice())*2.382,4);
double tps4 = p4d*10000;
double p5u = NormalizeDouble((OrderOpenPrice()-lowest)*3.236,4);
double tpb5 = p5u*10000;
double p5d = NormalizeDouble((highest-OrderOpenPrice())*3.236,4);
double tps5 = p5d*10000;

for(int i=0; i<OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false )
break;
if(OrderMagicNumber()!=magic || OrderSymbol()!=Symbol())
continue;
if(OrderType()<=OP_SELL)
{
if(OrderType()==OP_BUY && Bid>OrderOpenPrice())
{
if((Bid>=OrderOpenPrice()+Point*tpb1) && (OrderStopLoss()!=OrderOpenPrice()))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*tpb1,0,0,CLR_NONE);
return(0);
}
if((Bid>=OrderOpenPrice()+Point*tpb2) && (OrderStopLoss()!=OrderOpenPrice()+Point*tpb1))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*tpb2,0,0,CLR_NONE);
return(0);
}
if((Bid>=OrderOpenPrice()+Point*tpb3) && (OrderStopLoss()!=OrderOpenPrice()+Point*tpb2))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*tpb3,0,0,CLR_NONE);
return(0);
}
if((Bid>=OrderOpenPrice()+Point*tpb4) && (OrderStopLoss()!=OrderOpenPrice()+Point*tpb3))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*tpb4,0,0,CLR_NONE);
return(0);
}
if((Bid>=OrderOpenPrice()+Point*tpb5) && (OrderStopLoss()!=OrderOpenPrice()+Point*tpb4))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*tpb5,0,0,CLR_NONE);
return(0);
}
if((Bid>=OrderOpenPrice()+Point*(tpb5+ts)) && (OrderStopLoss()+Point*ts<Bid))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*ts,0,0,CLR_NONE);
return(0);
}
}
else if(OrderType()==OP_SELL && Ask<OrderOpenPrice())
{
if((Ask<=OrderOpenPrice()-Point*tps1) && (OrderStopLoss()!=OrderOpenPrice()))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*tps1,0,0,CLR_NONE);
return(0);
}
if((Ask<=OrderOpenPrice()-Point*tps2) && (OrderStopLoss()!=OrderOpenPrice()-Point*tps1))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*tps2,0,0,CLR_NONE);
return(0);
}
if((Ask<=OrderOpenPrice()-Point*tps3) && (OrderStopLoss()!=OrderOpenPrice()-Point*tps2))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*tps3,0,0,CLR_NONE);
return(0);
}
if((Ask<=OrderOpenPrice()-Point*tps4) && (OrderStopLoss()!=OrderOpenPrice()-Point*tps3))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*tps4,0,0,CLR_NONE);
return(0);
}
if((Ask<=OrderOpenPrice()-Point*tps5) && (OrderStopLoss()!=OrderOpenPrice()-Point*tps4))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*tps5,0,0,CLR_NONE);
return(0);
}
if((Ask<=OrderOpenPrice()-Point*(tps5-ts)) && (OrderStopLoss()-Point*ts>Ask))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Poi nt*ts,0,0,CLR_NONE);
return(0);
}
}
}
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #900 (permalink)  
Old 12-29-2007, 03:43 AM
Senior Member
 
Join Date: Oct 2007
Posts: 224
Dave137 is on a distinguished road
Cool How do you stop this from happening????

MACDI on 4-Hr graph shows positive, but if I use it as an indicator I get a sell because the MACDI on 1-Min may go negative for a brief period of time, but is not reflected on the 4-Hr graph. How do I code this so that my program is receiving the hourly average and not the 1-Min results.


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 06:16 AM.



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