Forex Factory (https://www.forexfactory.com/forum.php)
-   Platform Tech (https://www.forexfactory.com/forumdisplay.php?f=69)
-   -   How to make EA that send Open Price of Candle for every new candle (https://www.forexfactory.com/showthread.php?t=130059)

mbah_sangkil Nov 24, 2008 12:30am | Post# 1

How to make EA that send Open Price of Candle for every new candle
 
Hello, how to make an EA that send email contains Open Price of a candle when the new candle come up? I've made but everytime the price change, the EA send email. I want to make the EA send base on time frame. For example, if I put EA on M15, then it will send email and inform Open Price every 15 minutes. Thanks

mbah_sangkil Nov 24, 2008 2:41am | Post# 2

HELP....!!!!!!!!!!

lohikeitto Nov 24, 2008 10:59am | Post# 3

Hi mbah_sangkil,

I think it will work if you put this condition before Sendmail Order.

if (Volume[0] == 1)

"Volume[i] == 1" means first tick of the bar i. (and bar 0 means current bar)

If you want it to be timeframe independent, You can use iVolume() instead of Volume[].

iVolume(Symbol(), TimeFrame, i)

codobro Nov 24, 2008 4:19pm | Post# 4

Hello,

lohikietto, that is a different way to do it, and mimics a FirstTickOfBar that other platforms use.

Another more common way would be to set a boolean value and have it reset every bar.

And another different way is to use Open[i]. Since the bar will have only 1 open (compared to x close values until the bar completes), you can send a mail on the open of each new bar.

In coding there are many ways to do the same function. Pick one that works best for your EA.

lohikeitto Nov 24, 2008 6:46pm | Post# 5

Thanks codobro,

I have found a code posted by Ronald Raygun (at the thread "MAs at newbar..." or something) and thought it to be most sophisticated way to do it.

int CurrentBar;

int init()
{
CurrentBar = Bars;
return(0);
}

int start()
{
if(CurrentBar != Bars)
{
SendMail("","");
CurrentBar = Bars;
}
return(0);
}

Although I've never used it, there is iBars() for TF & Symbol independent.

Gadge007 Nov 27, 2017 7:02am | Post# 6

Does anyone know how to lock an ea ? need help asap


© Forex Factory