Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1468
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 wrote a simple code in mql4 that opens an order on a minute chart every time the price rises 30 pips from the nearest local minimum. After opening the order, the local low becomes the opening price of the order.
What I don't like about my code..... That it has to be executed on almost every tick. I can improve this code and it will not be executed on every tick, but on almost every minute candle. It means that the program has to do a huge amount of work to find the point where the order is opened.
Q:
Could you please suggest a language structure which would help me find the open point of the order mentioned in my code without trying ticks or candlesticks, or with a minimum possible try, i.e. for the program to spend as little time as possible on finding the open point.
Thank you for your help.
Good day to all.
I wrote a simple code in mql4 that opens an order on a minute chart every time the price rises 30 pips from the nearest local minimum. After opening the order, the local low becomes the opening price of the order.
What I don't like about my code..... It has to be executed on almost every tick. I can improve this code and it will not be executed on every tick, but on almost every minute candle. It means that the program has to do a huge amount of work to find the point where the order is opened.
Q:
Could you please suggest a language structure which would help me find the open point of the order mentioned in my code without trying ticks or candlesticks, or with a minimum possible try, i.e. for the program to spend as little time as possible on finding the open point.
Thanks for the help.
Thank you for your help.
But the result of my code is not the same as mine. Here is the result of my code on GBPUSD on a minute chart over a day from 04.01.2010 to 05.01.2010.
This is the result of my code
And this is a result of your code
Thank you for your help.
But the result of my code is not the same as mine. Here is the result of my code on GBPUSD on a minute chart over a day from 04.01.2010 to 05.01.2010.
This is the result of my code
This is a result of your code
Show code OnInit()
Show me the OnInit() code.
I just copied your code into MetaEditor and got the result, which is above.
Your code opens an order and counts 30 pips downwards (yellow), and mine counts downwards (blue)
Thank you for your help
I just copied your code into the MetaEditor and got the result above.
Thanks for your help.
I need your code to understand the point.
In your code LoU changes on every tick if price goes down, but in mine LoU changes only after opening a trade.
I need your code to understand what the point is.
In your code, the LoU changes on every tick if the price goes down, whereas my LoU changes only after a trade is opened.
You have 30 pips on the wrong side. I added a picture to the previous post
Agreed in my code LoU changes on every tick after opening each order. Without it the programme will not find the nearest local minimum, from which we should count 30 pips. I am thinking how to exclude the LoU change at every tick or at every minute candlestick, but the orders will be opened in the same places where my code opens them.And my code is in the first post. As soon as the price has passed 30 pips from the local minimum *bottom-up* - open an order. And my code opens the order exactly as I need it. But I want it to spend minimal time for that.
I just copied your code into MetaEditor and got the result above.
Your code opens order and counts 30 pips downwards (yellow), and mine counts downwards (blue)
Thank you for your help
My mistake...replace
My mistake...replace
Thanks for your help.
I did. It opens a huge number of orders (27657 orders), among which are the ones I need
Here is a screenshot of initial orders
My mistake...replace
Here's your code with the changed line.
How can I make the code open only the required orders?