Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 814
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
Ahh, pointed it out wrong, yes).
Re-checked separately. Only the sell ticket was wrong. Checked the rest too: orders, comparisons, modification. But I still have a stupor after placing orders. Everything worked fine on its own.
*Conditions for entering if(MA=MA1), is it wrong? Because =, is not a condition sign, the correct sign is "==", but if I spelled it that way the Expert Advisor does nothing at all. The other variants: ">=", "<=", "<", ">" that and "=" lead to placing orders and further stupor.
It is certainly not true, although the compiler will fix it, but who knows if it will correct it or not? Maybe it will substitute == or !=, or maybe it won't fix it at all but will simply ignore the check and set it always to true.
Compile the code with #property strict, there is a lot more to fix.
If we need to check for a crossover of 2 MAs, it is not checked by equality. The criterion must be something like "if MA1(2)<MA(2) and MA1(1)>MA(1) - then the second MA has crossed the first one upwards on the preceding candle". And equality can wait for a year.
And what is while(true), according to you?
Further:
How to organise an arrayof int type with 1 billion values and then sort it? Please, give me an example.
So far, with the standard means of MQL4 I can arrange an array of int numbers with only 2 million values.
How to organise an array of int type with 1 billion values and then sort it? Please, give me an example.
So far, with the standard means of MQL4 I can arrange an array of int numbers with only 2 million values.
Good wish. Please calculate the amount of memory required
Of course, it is not correct, although the compiler will correct it, but who knows if it is correct or not? Or it may replace == with != or not fix it at all, but simply ignore the check and set it always to true.
Compile code with #property strict, there are a lot of things to fix.
If you need to check crossover of 2 MAs, it is not checked by equality, the criterion must be something like "if MA1(2)<MA(2) and MA1(1)>MA(1) - then the second MA has crossed the first one upwards on the preceding candle". And equality can wait for a year.
And what is while(true), according to you?
Further:
while(true) - a loop where I pick up the trend:
-if an order breaks through a stop (Time>0) I put it at the same place where it was;
- if it reaches a certain level(NormalizeDouble(OrderOpenPrice()+TP*Point,Digits)<=NormalizeDouble(Ask,Digits)), then it goes into another loop (where the condition is the order type) where the profit is calculated in points and is modified depending on that.
Concerning the condition ""If MA1(2)<MA(2) and MA1(1)>MA(1) - the second MA has crossed the first one upwards on the previous candle"". , do the numbers in brackets mean candles? Here is my variant MA>Open[0] || MA<Open[0], will it work?
#property strict prescribed, corrected errors.
I have changed the way to get profit in points: the obtained difference between the current price and the open price is divided by Point (line 217 and 271).
I made type conversions in lines: 218, 272, 369. Is it correct?
Two errors have appeared:
possible use of uninitialized variable 'Prof' Test3.mq4 222 15
possible use of uninitialized variable 'Prof' Test3.mq4 275 15
dear experts....recently started to learn mql4 basics....i have a question for you....let's say i have a main indicator and filters....if one condition on the main indi is fulfilled, then certain conditions from filters should coincide with it, but if another condition is fulfilled on the main indi, then filters should have other conditions......I need this to open a trade...Can I use || sign in this situation or still can't...any answer please explain in an understandable way as I am still a fool...Respectfully!
dear experts....recently started to learn mql4 basics....i have a question for you....let's say i have a main indicator and filters....if one condition on the main indi is fulfilled, then certain conditions from filters should coincide with it, but if another condition is fulfilled on the main indi, then filters should have other conditions......I need this to open a trade...Can I use || sign in this situation or still can't...any answer please explain in an understandable way as I am still a fool...Respectfully!
while(true) - a loop where I pick up the trend:
And when do you think this loop should close?
?
About the condition ""If MA1(2)<MA(2) and MA1(1)>MA(1) - the second MA has crossed the first MA upwards on the previous candle"". , do the numbers in brackets mean candles? Here is my variant MA>Open[0] || MA<Open[0], will it do?
Yes, the candle number in brackets is the candle for which the MA value is taken. Yes, it will do with the opening price.
I have changed the method of getting profit in points: the obtained difference between the current price and the open price is divided by Point (line 217 and 271).
I made type conversions in lines: 218, 272, 369. Is it correct?
The Profit variable (to be declared as integer) is quite enough to calculate profit in pips, the other two are redundant:
And there are a lot of stoploss trawls in kodobase, why should I invent a lissapet with rectangular wheels?
And when do you think this cycle should close?
?
Corrected:
if(R==0)
{
while(true)
{
Sleep(30000);
Alert("Ошибка!");
DeleteBuy=OrderDelete(OrderTicketBuy);
DeleteSell=OrderDelete(OrderTicketSell);
return(1);
}
}
Calculation of profit too.
I inserted a message and error handling in the while (true) loop. The loop works, message is written, no errors. But it doesn't pass the condition, data doesn't seem to be updated.