That is a very bad idea.
Have you ever looked at the spreads when the first ticks arrives?
If you are going to offer them free money, they will take it.
Anyway if you really want, you can just put it in the OnTick() function and then filter for a new bar.
void OnTick()
{
//--- declare and initialize the trade request and result of trade request
MqlTradeRequest request={0};
MqlTradeResult result={0};
//--- parameters of request
request.action =TRADE_ACTION_DEAL; // type of trade operation
request.symbol =Symbol(); // symbol
request.volume =1; // volume of 0.1 lot
request.type =ORDER_TYPE_BUY; // order type
request.price =1; // price for opening
request.deviation=5; // allowed deviation from the price
request.magic =EXPERT_MAGIC; // MagicNumber of the order
---------------------------------------------------------------
it's ok?
No because that will open a order on every tick.
You could use
if(PositionsTotal()==0) { // ordeer here... }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi everybody
I want to write an Expert to be active when the market is closed.
and
when market is opening,in the first seceond send an buy positoin order by a Specified price.
in other words an expert to send an order by specified price At the moment of opening the market.
Can anyone guide me?