Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 999
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
I'm just learning.
SellClose = (AC<0.0 && RSI<30 && Open[1]>Close[1] && ? );
Instead of the question mark you should write - profit is greater than zero for the given instrument.
I'm just learning.
SellClose = (AC<0.0 && RSI<30 && Open[1]>Close[1] && ? );
Instead of the question mark you should write - profit is greater than zero for the given instrument.
It depends on your own will.
Like close with your hands.
That's no good, you have to automate it.
Like close with your hands.
That's no good, you have to automate it.
No, not by hand. I meant you can write in at your own will. But apparently I misunderstood the question the first time. To set the condition of profit on the instrument greater than zero, this profit should be calculated.
No, not by hand. I meant you can write it in at your own will. But I must have misunderstood the question the first time. This profit should be calculated to set the condition of profit by the instrument to be more than zero.
Is this how it should be done?
double profit = 0;
for(int i = 0; i < OrdersTotal(); i++)
{
if(OrderSelect(i, SELECT_BY_POS) && OrderSymbol() == _Symbol && OrderMagicNumber() == Magic)
{
if(OrderType() < 2)
profit += OrderProfit()+OrderCommission()+OrderSwap();
}
}
SellClose = (AC<0.0 && RSI<30 && Open[1]>Close[1] && profit + );
Is this how it should be done?
double profit = 0;
for(int i = 0; i < OrdersTotal(); i++)
{
if(OrderSelect(i, SELECT_BY_POS) && OrderSymbol() == _Symbol && OrderMagicNumber() == Magic)
{
if(OrderType() < 2)
profit += OrderProfit()+OrderCommission()+OrderSwap();
}
}
SellClose = (AC<0.0 && RSI<30 && Open[1]>Close[1] && profit + );
Are you kidding me?
Are you kidding me?
Thank you very much, it's all working.
Thank you very much, everything is working.
Thank you here,Alexey Viktorov
The Expert Advisor places only one order per algorithm, consider Sell:
SellOpen = (AC<0.0 && RSI<30 && Close[2]>Open[2] && Close[1]>Open[1] && Low[2]<Low[1] );
How to write the code so that it would continue placing orders until the AC<0.0 condition is met
No, not by hand. I meant you can write it in at your own will. But I must have misunderstood the question the first time. In order to condition profit on an instrument to be greater than zero, this profit has to be calculated.
Thank you very much. Everything works.