[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 163

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 can suggest the following option:
if(Hour()==11 && OrdersTotal()>0)
{
if(OrderSelect(0,SELECT_BY_POS)==true)
{
if(OrderType()==OP_BUYSTOP)
{
OrderDelete(OrderTicket());
}
}
}
And you don't use the expiry parameter. The disadvantage is that when trading, the computer must be running with the internet connected and the terminal switched on in order for the position to close.
What do you think if at the moment of pending order cancellation the price is close to it, i.e. pending order will be in the freeze zone.
Will it be deleted in this case using OrderDelete?
Will it be deleted in this case using the expiration parameter?
What do you think, if at the moment of pending order cancellation the price is close to it, i.e. pending order will be in the freeze zone.
Will it be deleted in this case. using OrderDelete?
Will it be deleted in this case using the expiration parameter?
I have started to learn programming. I have a practical question that is not covered in the textbook or is vaguely covered.
For example, I opened two stop orders with different magiks above and below the market price. A BuyStop order is opened at the requested price.
The program should now close the SellStop order with its own magician and open any stop order with a new magician.
How the program will determine that the BuyStop pending order with the same magician has become marketable,
so it can use it to place subsequent trade orders.
I would like to use MAGIC to identify orders.
Thank you.
I have started to learn programming. I have a practical question that is not covered in the textbook or is vaguely covered.
For example, I opened two stop orders with different magiks above and below the market price. A BuyStop order is opened at the requested price.
The program should now close the SellStop order with its own magician and open any stop order with a new magician.
How the program will determine that the BuyStop pending order with the same magician has become marketable,
so it can use it to place subsequent trade orders.
I would like to use MAGIC to identify orders.
Thank you.
Try using order types. OP_BUY, OP_SELL, OP_BUYSTOP, OP_BUYLIMIT, etc. If the first order you have is BuyStop, then SellStop and you want to check if BuyStop type has changed, use OrderSelect() to select the penultimate order among open and pending ones and compare this order type with the one you need, i.e. OP_BUY. If the last but one order type is OP_BUY, then you will delete the pending SellStop, etc. You can also compare it using OrderSelect().
beginner666999:
Попробуй использовать типы ордеров. OP_BUY, OP_SELL, OP_BUYSTOP, OP_BUYLIMIT и пр. Если, к примеру, первым у тебя ставится BuyStop ордер, потом SellStop ордер и нужно проверить не изменился ли тип BuyStop'а, выбираешь при помощи OrderSelect() среди открытых и отложенных ордеров предпоследний и сравниваешь тип этого ордера с необходимым тебе, т.е. OP_BUY. Если тип предпоследнего ордера "равен" OP_BUY, то удаляешь отложенный SellStop и т.д. Также можно и МАГИК сравнить при помощи OrderSelect().
I haven't come across it in practice yet, I just started programming recently myself and just yesterday I implemented this way of removing the pending orders.
I am appealing not only to beginner66999 but to other competent progamers as well.
I will skip magicians. It is clear that we have to make a complex. But, when opening pending orders, each of them has its own ticker. I cannot know these tickers when writing an EA, but I can name them somehow. Then the Expert Advisor will request the terminal to open a Buy orSell orderwith the same ticker, as well as to open a Buy orSellorderwith another ticker. At a certain ticker,truewill comeand the Expert Advisor will decide whether to execute this algorithm or not.Later, in three or four steps we can address to the order with the same ticker to cover it partially. Are my concepts correct and how could they be implemented in the code?
Hello, dear friends.
Here's a question. An EA opens an order by setting a certain magic value. Then MetaTrader is closed. Is there any way to restore magic after re-opening an MT (or, same thing) when opening an MT on another machine? I have just had an order open and then a kind person from my brokerage company reset the virtual machine. Result: all calculations down the drain.
Good afternoon, please advise who to contact to write an EA. In a nutshell: we open 2 identical buy and sell orders, the price passes 10 points up, we add another buy, passes another 10 points up, add a third buy and so on. If the price turns and goes down by 10 points, then we close the loss-making buy and open the sell. And every 10 points, we always close one loss-making order and add another one until the line-up is completed in one direction, for example, with 7 orders, only one order remains in the opposite direction. When the set number of orders in one direction has been lined up, the Expert Advisor closes all open orders.
I tried to trade by hand using this algorithm but it is very difficult and I do not always have time to place orders at fast movements. I am using mid-day range to get a grid of 7-10 orders in one direction. You need to adjust the following parameters in your EA: the step size between orders, lot size, SL, TP and number of orders of one direction so that the EA closes all orders. When all orders are closed, the EA should switch off automatically.
Perhaps there is a similar EA, but I would really like it to work as described. Thank you for your advices.
Not only to beginner666999, but also to other competent progessors.
Let's leave out the magicians. Well, it's pretty clear that we have to do a lot of work. But when pending orders are opened, each of them has its own ticker. I cannot know these tickers when writing an EA, but I can name them somehow. Then the Expert Advisor will request the terminal to open a Buy orSellorderwith the same ticker, as well as to open a Buy orSellorderwith another ticker. At a certain ticker,truewill comeand the Expert Advisor will decide whether to execute the algorithm. Later, in three or four steps we can address to the order with the same ticker to cover it partially. Are my concepts correct and how could they be implemented in the code?