I`m newbie on forex market. I`m trying to build my own EA, and I succeed but i have few question about some features...
I trade on 5 different currency pairs: EURUSD, AUDUSD, USDCAD, USDJPY and NZDUSD...on H1 timeframe.
I want to implement some new features in EA, for example when EA open long trade on one currency pair and that trade goes to -50pips that my EA open another long trade on the same pair.
And, if possible to code that they both close when I have cumulative profit...maybe first one is -20 pips, but the second is +30 and to close immediatelly both (so I have +10 pips profit).
Please, what i need put in my EA to it open the orders only when the time hour equals 00:00 ? I need that it open the order only in this hour, can you put here to me the programation code ?
Please, what i need put in my EA to it open the orders only when the time hour equals 00:00 ? I need that it open the order only in this hour, can you put here to me the programation code ?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
HI, I have problem. I need import ATR value from metatrader to csv file.
Unfortunately I do not know how to do.
Please help me write the script.
I tried using FileWrite - MQL4 Documentation and iATR - MQL4 Documentation. But I failed it..Well the example from help file of metaeditor works quite nice:
int handle;
datetime orderOpen=OrderOpenTime();
handle=FileOpen("filename", FILE_CSV|FILE_WRITE, ';');
if(handle>0)
{
FileWrite(handle, iATR(NULL,0,20,0));
FileClose(handle);
}
Problem with EA coding
Hello!
I`m newbie on forex market. I`m trying to build my own EA, and I succeed but i have few question about some features...
I trade on 5 different currency pairs: EURUSD, AUDUSD, USDCAD, USDJPY and NZDUSD...on H1 timeframe.
I want to implement some new features in EA, for example when EA open long trade on one currency pair and that trade goes to -50pips that my EA open another long trade on the same pair.
And, if possible to code that they both close when I have cumulative profit...maybe first one is -20 pips, but the second is +30 and to close immediatelly both (so I have +10 pips profit).
Could someone help me code it?
Well the example from help file of metaeditor works quite nice:
int handle;
datetime orderOpen=OrderOpenTime();
handle=FileOpen("filename", FILE_CSV|FILE_WRITE, ';');
if(handle>0)
{
FileWrite(handle, iATR(NULL,0,20,0));
FileClose(handle);
}
Realy thanks.
How to adjust to import the entire history of ATR. Then complete history atr values + date?
Realy thanks. How to adjust to import the entire history of ATR. Then complete history atr values + date?
int handle;
datetime orderOpen=OrderOpenTime();
handle=FileOpen("filename", FILE_CSV|FILE_WRITE, ';');
if(handle>0)
{
for(int x=0;x<Bars;x++)
{
FileWrite(handle, TimeToStr(Time[x]),iATR(NULL,0,20,x));
}
FileClose(handle);
}
int handle;
datetime orderOpen=OrderOpenTime();
handle=FileOpen("filename", FILE_CSV|FILE_WRITE, ';');
if(handle>0)
{
for(int x=0;x<Bars;x++)
{
FileWrite(handle, TimeToStr(Time[x]),iATR(NULL,0,20,x));
}
FileClose(handle);
}
Wow, I do not know what to say. Thank you so much. You really helped me
Hi guys !
Please, what i need put in my EA to it open the orders only when the time hour equals 00:00 ? I need that it open the order only in this hour, can you put here to me the programation code ?
I trying this but it not works:
if (TimeHour(TimeCurrent() == 0)
{
OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, SL, TP, 0, Magic, 0, Lime);
}
Thank you very much !
Hi guys !
Please, what i need put in my EA to it open the orders only when the time hour equals 00:00 ? I need that it open the order only in this hour, can you put here to me the programation code ?
I trying this but it not works:
if (TimeHour(TimeCurrent() == 0)
{
OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, SL, TP, 0, Magic, 0, Lime);
}
Thank you very much !Try this way:
int start()
{
....
if(Hour()==0&&mark==0)
{
OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, SL, TP, 0, Magic, 0, Lime);
mark=1;
}
if(Hour()>1)mark=0;
...
}Try this way:
int start()
{
....
if(Hour()==0&&mark==0)
{
OrderSend(Symbol(), OP_BUY, Lot, Ask, Slippage, SL, TP, 0, Magic, 0, Lime);
mark=1;
}
if(Hour()>1)mark=0;
...
}IT WORKS !!! tHANK YOU VERY MUCH MY FRIEND, YOU IS THE MAN!!!
How to
How to add lines in indicator like RSI 80% RSI 20% in mql4 code , not through manual method
Guide the code used.
How to add lines in indicator like RSI 80% RSI 20% in mql4 code , not through manual method Guide the code used.
By buffer or by instruction
By instruction is something like
#property indicator_level1 30
#property indicator_level2 70