Questions from Beginners MQL5 MT5 MetaTrader 5 - page 405
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
Here's the code:
You do not consider the possibility that OrderStopLoss() is equal to zero. And zero in any case will be less than the expressionAsk+(TrailingStop+TrailingStep)*Point, and the condition will return false.
Thank youVitalii Ananev,Vladimir Zubov!
I am writing an EA based on the RSI indicator. The principle of the EA will be to open orders by the indicator but it will also close by the same indicator (I do not know closing price)
if(OrderType()==OP_BUY && irsa <=20 || irsa >=40 )
OrderClose(ticket,Lot,Ask,Slippage,Blue);
return(0);
This condition is not met. Why? (It opens and immediately closes the order, and so on in the loop).
Here is the main question. My Expert Advisor will work with a large number of orders and I need to calculate the average, high and low price for all orders in the market, how do I find the closing prices of all orders to achieve a total profit and other similar operations?
As indicated in the reference gives an error.
Yes!? And what kind of error does it give you? What does the compiler say?
Thank youVitalii Ananev,Vladimir Zubov!
I am writing an EA based on the RSI indicator. The principle of the EA will be to open orders by the indicator but it will also close by the same indicator (I do not know closing price)
if(OrderType()==OP_BUY && irsa <=20 || irsa >=40 )
OrderClose(ticket,Lot,Ask,Slippage,Blue);
return(0);
This condition is not met. Why? (It opens and immediately closes the order, and so on in the loop).
Here is the main question. My Expert Advisor will be working with a large number of orders and I need to calculate the average, high and low price for all orders in the market, how do I find the closing prices of all orders to achieve a total profit and other similar operations?
The closing price of a position will not be known until the position is closed. After that, you can find out the closing price in the history of trades with the function OrderClosePrice().
It opens and immediately closes the position, because the closing condition is met. Check the logic of the close condition. Try to write it in this way to begin with:
Read reference about priority of calculations of logical expressions.
"You need to calculate the average, high and low price for all orders in the market" - I'm sorry, what price are we talking about? The open order price? The current price of a currency pair? The price when the total profit of all open positions will be reached without any losses?
Yes!? And what kind of error does it give out? What does the compiler say?
The closing price of the position will not be known until the position is closed. The OrderClosePrice() function can then be found in the transaction history.
It opens and immediately closes the positions, because the close condition is fulfilled. Check the logic of the close condition. Try to write it in this way to begin with:
Read the help on priority of calculations of logical expressions.
Well, how to be in for example with a grid, there need a total TP or (and) the total price.
Maybe there is a buffer(s) where the price should be saved or maybe the indicator itself has a buffer where the open price of the last order is saved (and you can take and save the price from there to our global buffer)
If we set a grid, we will need a total TP or (and) a total price.
Maybe there is a buffer(s) to save the price or in the indicator itself maybe there is a buffer where the opening price of the last order is stored (and from there we can take and save it to our global buffer)
Thank youVitalii Ananev,Vladimir Zubov!
I am writing an EA based on the RSI indicator. The principle of the EA will be to open orders by the indicator but it will also close by the same indicator (I do not know closing price)
if(OrderType()==OP_BUY && irsa <=20 || irsa >=40 )
OrderClose(ticket,Lot,Ask,Slippage,Blue);
return(0);
This condition is not met. Why? (It opens and immediately closes the order, and so on in the loop).
Here is the main question. If your EA will be working with a large number of orders and you need to calculate the average, high and low price for all orders in the market, how do you find the closing price of all orders to achieve a total profit and other similar operations?
You are trying to close a buy order on an asc, if you don't understand elementary things - read the documentation.
Or are you used to the rule of thumb?
If we set a grid, we will need a total TP or (and) a total price.
Maybe there is a buffer(s) to save the price or in the indicator itself maybe there is a buffer where the opening price of the last order is stored (and from there we can take and save it to our global buffer)