Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
My apologies - I had placed this in the wrong section...but here goes.
So I’m trying to piece together my first EA… obviously I’m at a dead end. The concept is to combine two functions which are:
Run (close profitable trades) executed every designated (time cycle)
I have two user input options – 1 (designate profitable) and 2 designate (time cycle). I believe most of the code is in order. I am left with one last error “end program”.
Can someone with a bit more experience at coding please correct what I’m doing wrong? It’s driving me CRAZY!!!
how do I use file functions so that it appends data to the end of the file rather than overwriting it. http://www.forex-tsd.com/62009-post1150.html
please reply on the thread that this link goes to where I normally read.
How to retrieve a specified closed order using HistoryTotal() ?
Hi All
is there a way using HistoryTotal function to be able to find a particular order (buy or sell) closed ?
I tried with this code but it seems not working :
Code:
int hstTotal=HistoryTotal();
for(i=0;i<hstTotal;i++)
{
//---- check selection result
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)
{
if (Debug==true) Print("Access to history failed with error (",GetLastError(),")");
break;
}
if (OrderType()==OP_BUY && OrderComment()=="LONG")
{
..take some action...
}
if (OrderType()==OP_SELL && OrderComment()=="SHORT")
{
..take some action...
}
}
And when a buy order was in place using OrderSelect I identified this using "LONG" as comment (and "SHORT" if a sell order) :
Hi All
is there a way using HistoryTotal function to be able to find a particular order (buy or sell) closed ?
I tried with this code but it seems not working :
Code:
int hstTotal=HistoryTotal();
for(i=0;i<hstTotal;i++)
{
//---- check selection result
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)
{
if (Debug==true) Print("Access to history failed with error (",GetLastError(),")");
break;
}
if (OrderType()==OP_BUY && OrderComment()=="LONG")
{
..take some action...
}
if (OrderType()==OP_SELL && OrderComment()=="SHORT")
{
..take some action...
}
}
And when a buy order was in place using OrderSelect I identified this using "LONG" as comment (and "SHORT" if a sell order) :
Maybe is not supported OrderComment using MODE_HISTORY mode? And if so how can I solve this issue?
thx a lot
Skyline
Skyline,
Be aware that the broker will append the comment with their own comments on the order for different reasons, and always when then the order is closed by SL or TP. What are the criteria for looking up the trades? Once you defone that then you'll have you solution.
__________________
"Anyone who has never made a mistake has never tried anything new." -Albert Einstein
Be aware that the broker will append the comment with their own comments on the order for different reasons, and always when then the order is closed by SL or TP. What are the criteria for looking up the trades? Once you defone that then you'll have you solution.
Oh that's no a good news :|
Anyway i'm trying to explain my problem : in my EA I have different kind of buy (or sell), I have a kind that have to be opened whenever a condition is met also a lot of time in a day (something like that when price penetrate an EMA then an order is placed), and another type that have to be triggered only once per day depending on different conditions based on different EMA. So what I have to do is to let the first kind of buy/sell to open/close orders a lot of time in a day while the second kind of buy/sell orders have to be opened only once a day, so I thought that if I could localize in some way any kind of buy/sell order in history i could solve my problem , but it seems not possible
I've got a lot of private messages asking me for helping with some pieces of code.
Here you can post your questions related to MQL4, and I'll do my best to answer them.
Hi,
I am trying to get the high, low, open, close for the previous day @ 0 GMT for my EA. It works fine for all days except sunday in MIG & IBFX where it gets values for sunday from saturday and not friday. FXDD gets it crrectly from friday close since it doen't have a new bar for saturday.
Its coded as:
High[1], Low[1], Close[1] etc. How do I fix the code for sunday so that it gets values only from friday close and not saturday. Please help!
I am trying to get the high, low, open, close for the previous day @ 0 GMT for my EA. It works fine for all days except sunday in MIG & IBFX where it gets values for sunday from saturday and not friday. FXDD gets it crrectly from friday close since it doen't have a new bar for saturday.
Its coded as:
High[1], Low[1], Close[1] etc. How do I fix the code for sunday so that it gets values only from friday close and not saturday. Please help!
from your description, i'm assuming you are using this on the daily chart???
to answer your question, here's how i would solve the problem.
PHP Code:
if (DayOfWeek() == 0) { High[2], Low[2], Close[2], //etc }
else { High[1], Low[1], Close[1],//etc )
of course, you would arrange the high low and close to however you are using them
__________________
"One's ability to accomplish his or her goals is limited only by the ingenuity of how one uses what he or she already knows."- Eaglehawk
REMEMBER, "Genius is nothing but a greater aptitude for patience." –Benjamin Franklin
____________________________________
Have a simple ea you just can't figure out how to code??? Odds are you can make it here. Just remember to push complete when you're done, NOT SAVE!!! http://sufx.core.t3-ism.net/ExpertAdvisorBuilder
I am trying to get the high, low, open, close for the previous day @ 0 GMT for my EA. It works fine for all days except sunday in MIG & IBFX where it gets values for sunday from saturday and not friday. FXDD gets it crrectly from friday close since it doen't have a new bar for saturday.
Its coded as:
High[1], Low[1], Close[1] etc. How do I fix the code for sunday so that it gets values only from friday close and not saturday. Please help!
__________________
You need proffesional mql coder? Contact me! I will help you!
........................................ http://www.fxservice.eu/
........................................