[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 586

 
Craft:

Good afternoon, trying to figure out how to write an EA. I took the EA template from the article on mql4 website, added my own conditions to understand the debugging and functionality, entered the conditions for opening positions:

I have added my own conditions (or changed existing ones) to make sure the orders were executed by fakut.

see three posts above - analyze only formed bars, starting from 1
 

or use the condition - if there are no open orders on the zero bar, it is OK to open:

if((OrdersTotal()>0&&iBarShift(OrderOpenTime())>0)||OrdersTotal()==0)
{
   //открываемся
}
 
alsu:
see three posts above - analyse only formed bars from 1
But for that iMAOnArray(MyATR,0,PerB,0,MODE_SMA,1) and prescribed 1 at the end, and Open[0] is not changed during the bar and I will need it.
 
Craft:
But for that iMAOnArray(MyATR,0,PerB,0,MODE_SMA,1 ) and prescribed 1 at the end and Open[0] is not changed during the bar and I will need it.
but Ask and Bid are changed on every tick - that's why the condition may be triggered multiple times during one bar
 
alsu:
but Asc and Bid change on every tick - so the condition can be triggered many times during a single bar
What should we do to make the execution happen once, maybe replace them with High[0] and Low[0]? Or are there other commands, maybe the condition to execute within a bar once?
 
Craft:
What about to make execution happen once, maybe replace them with High[0] and Low[0]? Or there are other commands, maybe the condition to execute inside the bar once?
I already wrote it above, didn't I?
 
alsu:
I already wrote it above.

I've been reading, had fun on the fund before, now I want to try forex. In WelsLab on the fund this is easy to do via stop:

MyATR = SMA.Series((((High-Low)/Low), PerB)[i-1] ;

if (BuyAtStop(i, (Open[i] + Open[i]*MyATR), "") ;

Can't it be done in MetaTrader?

 
Craft:

I've been reading, had fun on the fund before, now I want to try forex. In WelsLab on the fund this is easy to do via stop:

MyATR = SMA.Series((((High-Low)/Low), PerB)[i-1] ;

if (BuyAtStop(i, (Open[i] + Open[i]*MyATR), "") ;

Can't this be done in MetaTrader?

No, that won't work. only through analysis of order history. that's how our MQL is - it's not very good, but it has its own features :))) that's why most of useful functions are handwritten.
 
alsu:
No, that won't work. only through analysis of order history. that's how our MQL is - it's not very good, but it has its own features :))) that's why most of useful functions are handwritten.
I don't mind. Can I get a working example or link?
 
Craft:
I don't mind, can I get a working example or a link?
I'm going out tonight, or maybe someone will give me one sooner.