i just seen a forum that has the function of posting mql code into the forum
it's easier and automatically change the color into the Metaedtor-like scheme
this will be more helpful to post the code here without attacthing files
hope this is posible and someone expeert can creat itI think you could wrap the code with PHP tags. The button is on the right of the editing tools (bold, italic, underline, etc.). Hope this help
Example :
{
total = OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol() &&
OrderMagicNumber()==MagicNumber)
{
subTrailingStop(OrderType());
}
}
}i just seen a forum that has the function of posting mql code into the forum
it's easier and automatically change the color into the Metaedtor-like scheme
this will be more helpful to post the code here without attacthing files
hope this is posible and someone expeert can creat itThis is very helpful idea!
But we are talking about vBulletin addon which need a lot of work!
Do you have link to this addon or the forum?
- webget dll: work with url, remote computer, calendars and so on.
- Execute SQL from Metatrader: about connecting MetaTrader to a Microsoft SQL Server.
- Programming Modules with many programming functions. Thanks iscuba11.
- various helpful MQL4 codes from RickD.
- How allow the EA to run only during June 2007 for example.
- Need procedure to only trade at certain times
- Idea about new order functions: good discussion with examples.
How do I code an EA to enter a trade at the open of a new candle?
Hi everyone,
Please forgive my ignorance, but I am new to the programming side of MQL4.
What I am trying to accomplish is enter one trade at the open of a new candle.
For example, if I had a 30min chart open, I would like to enter one trade at the open. Or if I had a 4hour chart open, how would I enter the trade at the open of that chart?
Also, I would like to enter only 1 trade at the open. I have tried a few commands and found it either entering the trade many times during the first minute, or not at all.
I have tried the "time current" function as well as "if minute = XXXX". The EA works when I backtest it, but when I try to put it on my live demo, it only works once in a while.
Any input would be greatly appreciated.
Thanks in advance.
Moved your post to this thread where you will find some links about how to code one trade oer candle etc.
besides there are some other threads:
- Trade context is busy: how to solve this problem.
- Trading Times Enhancement: very usefull code about only trade during certain periods.
- avoid plotting the EA on the wrong chart: some usefull codes about EA and certain timefame to trade.
- Use GlobalVariableGet() in an indicator: good thread with codes and explanation.
- List of Arrow Style and others like like fractal, circle, arrow up, arrow down and so on.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i just seen a forum that has the function of posting mql code into the forum
it's easier and automatically change the color into the Metaedtor-like scheme
this will be more helpful to post the code here without attacthing files
hope this is posible and someone expeert can creat it