Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1472
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
Pr is a variable so that only 1 order is opened after 30 pips. Without this variable they open on every tick
So you don't need this variable...and there's already less load)
Even worse... still need to know the number of bars
I tweaked ...try
I did. It's the same.
Your code.
So you don't need this variable...and already the load is less)
Maybe I don't need it. But it's not the one I'm struggling with.....
Probably not necessary. But it's not the one I'm struggling with.....
1) If you're struggling with speed, any code optimization is a plus.
2) The difference in results because you don't have LoU initialization at startup is nothing... EMPTY
Even worse...still need to know the number of bars
I tweaked ...try
Alternatively, if Bid - Low[? ] >= 30 p. we should open an order. But how do we know the number of Low[ ] after Bid goes higher than Low[ ] by 30 points?
And if Bid goes down, that means a new low...and from which low should the calculation be made?
1) If you're struggling with speed, any code optimization is a plus.
2) The difference in results because you don't have LoU initialisation- at startup doesn't equal anything... EMPTY
So if I assign a value to LoU when I declare it, the code will run much faster ?
I have assigned it the opening price of the first bar from 04.01.2010.
And if Bid goes down, it means a new low...and what is the low to calculate from?
Let it go down, the main thing is that the order opens in 30 pips. And after it is opened, let the price go down to find the new minimum. Imagine that we have the current Bid and it is 30 points away from Low[ 50] and we can open an order. If ( Bid - Low[ 50] > 30 points ) - open an order, how will we know that it is the 50th candle low? So, in this case we should check not what was before the local minimum but what was after it.
And in this case it will not matter how much the price will fall after the order is opened.
I don't think the fractal indicator is right for me. It will miss many orders.
The order opened by my code with price checking on each tick is highlighted in blue. It seems to me that a fractal does not say anything necessary to me in this case.
I gave a fractal as an example. And how you determine the minimum (in your case) is a military secret... or you do not understand what I am asking.
Let it drop, the main thing is that the order will open in 30 pips. And after it is opened, let the price go down to find a new low. Imagine that we have the current Bid and it is 30 points away from Low[ 50] and we can open an order. if ( Bid - Low[ 50] > 30 points ) - open an order. But how to check if it is the 50th candle low? So, in this case we should check not what was before the local minimum but what was after it.
you don't need to count the bars
After the order is opened, assign to the variable the value Low[0] (the current bar minimum) and after the bar is closed, if the value of Low[1] is less than the variable, assign a new value,
if not, the old value is retained, i.e. the minimum.