Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1590
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
Good evening and good mood everyone!
I am trying to understand one question. Let's say there are two grids of orders set in both directions from the current price. When the current price moves upwards, all pending orders can be activated (this is an ideal variant). Or they may not activate, but it is not so important for now. If all pending orders are activated upwards, then how to determine the prices of the first and last positions of the upper grid (marked with red arrows in the picture). This is the most important point in my question!!! When the price moves downwards, it is the same.
I prepared a small script to start at least from something. Yes, and one more important point - the number of open positions up and down can change in the course of trading. What are your thoughts on this issue?
Regards, Vladimir.
Good evening. Strategy tester MT5. Optimisation mode. Parameters tab. How can I make it so that when I tick a parameter line that should be optimised, the font of this line switches from normal font to bold font?
It already does that! At least it does on my terminal (build 5260, on Windows 10).
Good evening and good cheer everyone!
Regards, Vladimir.
You forgot to write that the account is netting.
You have the time ofposition opening . Request the history of trades from the beginning of position opening. Choose the first and the last trade.
I prepared a small script to start at least from something. Yes, and one more important point - the number of open positions up and down can change in the course of trading. What are your thoughts on this issue?
Regards, Vladimir.
If the account is hedge, you will have open positions for each trade.
If netting, then you have one position that has an opening time. Request the history of trades from the time of opening the position. Find the first and last trade.
If the orders are limit orders, you can check the orders, but if stop orders, it is better to check the price of trades, because a trade on a stop order can open with slippage.
I haven't checked it, but that's how it looks like.
If the account is hedge, you will have open positions for each trade.
If netting, you have one position with an open time. Request the history of trades from the time the position was opened. Find the first and last trade.
If the orders are limit orders, you can check the orders, but if stop orders, it is better to check the price of trades, because a trade on a stop order can open with slippage.
I haven't checked it, but that's how it looks like.
Thank you, Alexander, for your response and the code! The account is a hedge. The difficulty for me is that out of a bunch of open positions (let's say five up and five down from the current price) I will need to find two extreme positions, both on the grid up from the current price and on the grid down.
Thanks again for the code!
Regards, Vladimir.
Thank you, Alexander, for the response and the code! The account is a hedge. The difficulty for me is that out of a bunch of open positions (let's say five up and five down from the current price) I will need to find two extreme positions, both on the grid up from the current price and on the grid down.
Thanks again for the code!
Regards, Vladimir.
Maybe like this.
I prepared a small script to start at least from something. Yes, and one more important point - the number of open positions up and down can change in the course of trading. What are your thoughts on this issue?
Regards, Vladimir.
Vladimir, in case of restarting the Expert Advisor, we list all open positions in OnInit()...
And then the OnTradeTransaction function works in which the price is compared and if it is the next position, the variable takes this value.
You can insert the symbol and magik checks yourself.
This is already happening! At least on my terminal (build 5260, on Windows 10).
Maybe so.
I am at work today and can't get to the code yet. Thank you, Alexander. I will try it tomorrow.
Regards, Vladimir.