Haha, solved it myself... Thanks anyway... For those who might be interested, I deleted "for()" and replaced if(OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS,MODE_HISTORY) == true)
What if
if( OrdersTotal() == 0 && OrdersHistoryTotal() == 0 )
no order will be taken, ....
also OrderSelect is a fonction which select an order, it should be close an soon as the order as been selected, and the value be stored into variable
else { lots = 0.01; Print("Nenalezen minulý obchod"); } }} // close fonction
then 2 case no order in history, an order in history
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello guys, Im here new and also Ive been studying MQL for about a week (no previous experience with programming)... I tried to write a simple EA (only to practice what I've learnt)
The idea is to double the lot size if the previous trade didnt work out well... if it again doesnt work out well then double the lot size again and so on... The signal for Buy/Sell depends on iMA
But Im struggling a lot with OrderSelect() and for() ... I think it selects the wrong order and therefore, it doesnt work properly... Concerning function for() , I do understant what it does but I cant figure out what to put into the condition for continuing the loop, or stopping it in the right moment.
Please, either give me some link to the article which might help me to understand this issue, or if you could simply explain it...
(I went through Help (F1) and a lot of articles, but nothing helped me...)
Thanks in advance