Ask! - page 89

 

time calculation

Hi,

I've been working on a place pending order script but can't set the expiry time based on my entered time i.e if I want the order to expire at 15:30 I need to calculate distance between curr time and expiry time, this will give me a vlaue which is time to expire.

I've asked for the following values

extern int To_Hour = 15;

extern int To_Min = 30;

and used the following code to get the correct time distance but it doesn't work.

//make time hr & min one value

int time_expire = To_Hour * 60 * To_Min * 60 * 60;

//get curr time as value

datetime curr = TimeCurrent();

//subtract one from the other so 15:30 - 10:15 = 5hrs 15 mins to expire

expiry = time_expire - curr;

I think I am right in understanding you can't just set time to expire as a time value but need to tell MQ4 number of hrs, mins and seconds to expire time.

Thanks in advance for help with this,

Kev

 
 

if(Bid >= CurrentLow+(Point*Ret2))

OrderSend(Symbol(),OP_SELL,Lots*2,Bid,3,Bid+(SL2*Point),Bid-(TP2*Point),"Albatross_v1",MagicNumber,0,Green);

total = 0;

return(0);

total = 0 doesn't have sense, try CurrentLow = 1000 instead. But it depends of what you want to do: may be you want to restart once both orders are closed, not immediately after the second one is open ?

Also, return(0) is not needed here, and you have to delete the empty ini(), deinit() and start() function : you cannot have two functions with the same name; you have mixed a template to build an indicator with one to build an EA.

 

2 EA in 1 code

Hi all, i'm now trying to build 2 ea in 1 code, that's mean, 2 different indicator, 2 rules for entry and exit..is there any sample?

 

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.

 

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:

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

 

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???

 

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?

 

Need help

Hello.

Could someone add BE stop to this EA please.

Thank in advance.

Cha.

e-trendmanager.mq4

Files:
 

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