[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 829
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Might be useful!!! Try to base it on one price: say Bid. The opening price for OP_SELLSTOP will be Bid , and for OP_BUYSTOP - Bid+87*Point (or whatever you need).
Now one magician, the parameters are set to
Please help. Maybe someone knows how to implement a function in the code, which compares the penultimate value from the history with the last (we're talking about closed positions) no matter what value (for example OrderCloseTime()), and if they are different (in this case the penultimate is less than the last) - make a BLA-BLA-BLA. If possible refine my code, or write your own if you've got it in the wrong direction.
double C_T_L_C_P() {
datetime t;
double r=0;
int i, k=OrdersHistoryTotal(), q=0;
if (q==0)
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)==true) {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (t<OrderCloseTime()) {r=OrderCloseTime();}
}}}
return (r);}
THANKS IN ADVANCE!!!
Help with checking.
After the first unit appears in the cycle, check whether this unit will hold for t+t1 time (check every delta seconds). If it holds, we buy it, and if at some point it does not hold, we exit the loop. In other words the signal is valid, if it was checked every delta interval and was always one.
Am I thinking correctly?
Help with checking.
After the first unit appears in the cycle, check whether this unit will hold for t+t1 time (check every delta seconds). If it holds, then we buy, and if at some point it does not hold, then we exit the loop.
Am I thinking correctly ?
The result is an infinite while loop (t is always <t+t1, only if t1=0). In the loop sign1 always =1
The result is an infinite while loop (t is always <t+t1, only if t1=0). In the loop sign1 always =1
How to fix the error ?
How to correct an error ?
To fix an error, you have to detail the algorithm (not the code, but the algorithm). And then overlay the code on the algorithm
To correct the error, the algorithm must be detailed
A binary signal 0 or 1 is received. If a 1 is received, then from this moment we start checking if it will hold for 10 min (600 sec) checking every 60 sec. If all 10 minutes there was one - Buy, and if at least once there was no one then finish checking and consider that there is no signal for opening.
A binary signal 0 or 1 is received. If a 1 is received, then from this moment we start checking if it will hold for 10 minutes (600 seconds) checking every 60 seconds. If all 10 min were one - Buy, and if at least once was not a one then finish checking and consider that there is no signal for opening.
It is not clear in the code how the discrete signal sign0 changes. In the presented code the signal does not change. There is an unsuccessful attempt to work with changed t