[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 347
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
Hello, here's a question. How can I write in the code to only perform an operation on a fixed fractal?
If fractal is fixed, it's ....
my fractal
Hmm. Yes, no problem finding the appropriate pending order this way if the number of pending orders in each direction is the same. And if different, then this will not work as I understand it.
Then determine the fact of triggering of a pending order and delete the most distant opposite one.
All this is done only for one fact and one pending order at one moment in time. There is no need to create a number of triggered and number of deleted, as you are trying to do. You will catch the fact of transformation of the pending orders on one tick. All other triggers (if there are any) will be determined by the next tick.
berezhnuy because of the spread, which is several times bigger on weekends.
Dear programmers, here is the code for counting buy and sell orders to open only one buy or sell order:
int CountBuy()
{
int count = 0;
for(int trade = OrdersTotal()-1; trade >= 0; trade--)
{
OrderSelect(trade, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == Symbol() && OrderMagicNumber() == magic)
{
if(OrderType() == OP_BUY)
count++;
}
}
return(count)
}
//+------------------------------------------------------------------+
int CountSell()
{
int count = 0;
for(int trade = OrdersTotal()-1; trade >= 0; trade--)
{
OrderSelect(trade, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == Symbol() && OrderMagicNumber() == magic)
{
if(OrderType() == OP_SELL)
count++;
}
}
return(count);
}
And everything seems to work, but in my EA, there are conditions to buy and sell on some candlestick patterns using TP and SL. But when this condition is fulfilled and TP is triggered, then at 0 candle's formation the conditions for order opening still remain true and new orders are opened, which should not be done at that moment. Could you please tell us which code to use to disable further opening of orders? The EA itself is attached.
Then determine the fact of a triggered pending order and delete the furthest opposite one.
All this is done only for one fact and for one time. There is no need to create a number of triggered and number of deleted, as you are trying to do. You will catch the fact of transformation of the pending orders on one tick. All other triggers (if there are any) will be determined by the next tick.
And what if there is more than that per tick? If, let's say, the step between the orders is very small, then more than one order can trigger. Of course, we will not be able to perform all necessary actions in time.
What if more passes in a tick? If, let's say, the step between the orders is very small, then more than one order can be triggered. Of course, we will not be able to perform the required actions in time.
The loop on open positions in search of triggered orders on the current bar and deletion of positions in the same loop.
Well, this loop will be repeated and everything will be deleted again. I also have a condition in the variant I have at the moment:
I.e. it should delete untilordersToDelete is zero. But it destroys everything. It seems to be elementary, but some outrage happens. There is nothing at all about such moments in a worthless tutorial. I already tried it both ways and rewrote it in different ways, it didn't work as I should.
Rewritten differently:
Kim, also looking for the same way. Found an order with a minimum opening price, defined its position, and selected this order, defined its ticket and deleted it. But it is not deleted.