[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

 
beginner666999:


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?

 
solnce600:

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?





The theory says that if the order price is in the freeze zone, it won't be deleted. Here is an excerpt from the book.mql4.com: "It means that, for example, if the market price = 1.3800, there is a pending order with the opening price 1.3807 and the broker set the value = 10, then the pending order is in the freeze zone, i.e., we can neither delete nor modify it". I haven't come across it in practice yet, I have only recently started programming myself and just yesterday I have implemented such a way of deleting pending orders. As for theexpiration parameter,I don't even know. How about to ask Alpari's technical support? In fact, there is no difference, because boththe expiration and the request from the terminal are trying to do one thing, i.e., delete the order that is in the freeze zone.

 

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.

 
00007:

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?

 
Good afternoon to all. Can you help me find out what is the cause? The chart is drawing a jagged pattern between candles on a one minute time frame with huge gaps...
 

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.

 
Hello! Which is faster? IClose (zero bar) Or Marketinfo ?
 

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.

 
00007:


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?

It is best to start learning everything from a textbook seriously and will come out faster, you will save your time and ours! You will not start with the Expert Advisor straight away, because you are a beginner, not an expert! You will always have time to lose your deposit. Don't think that you will suddenly make money with it!
Reason: