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
Create two arrays. One by ticket number, the second by price. Then sort the array by price, moving the ticket numbers at the same time (without breaking the connection). Then at one end of the array will be the lowest price, at the other the highest price. Now we have to change one of extreme orders.
>> Thank you.
I haven't practically worked with arrays yet.
For example, let's say I have 10 BUYSTOP orders. I set their setup prices:
Then, I set an array of setup prices, with order 1 being the price closest to the current price.
int ArrayCents = { price1,price2,price3,price4,price5,price6,price7,price8,price9,price10 }
And how to create an array by ticket is not clear to me. Where do I get the order tickets?
What's something like this
Didn't check the code.Apparently function works like this:
MiniMaxOrderPrice(string lSymbol="", int lMagic=-1, int lOP=-1, int reversi=0)
Parameters:
lSymbol= - symbol name ("" - any symbol, NULL - the current symbol)
lOP=-1 - operation (-1 - any order, in our case -OP_BUYSTOP )
lMagic=-1 - MagicNumber (-1 - any magician)
//---------------------------------------------------------------------------------------------
But what does "int reversi=0" mean - it is not quite clear to me !
The function was copied normally:
0 - lowest price
1 - the biggest ?
//-------------------------------------------------------------------
And also, -why exactly did we take the stoploss as a price ?
And why can't we change the opening price ?
OP_BUYSTOP - because these are pending orders (and not positions), and just the end result of the event is to change the opening (triggering) price of a specific order.
Apparently function works like this:
MiniMaxOrderPrice(string lSymbol="", int lMagic=-1, int lOP=-1, int reversi=0)
Parameters:
lSymbol= - instrument name (" - any symbol, NULL - current symbol)
lOP=-1-operation (-1 - any order, in our case -OP_BUYSTOP )
lMagic=-1 - MagicNumber (-1 - any magik)
//---------------------------------------------------------------------------------------------
But what does "int reversi=0" mean - it is not quite clear to me !
The function was copied normally:
0 - the smallest price
1 - the biggest ?
//-------------------------------------------------------------------
And also, -why exactly did we take the stoploss as a price ?
And why can not we change the opening price?
OP_BUYSTOP - these are pending orders (and not positions) which means that in the end we have to change the opening price of the chosen order.
So take whatever price you need. The open price for the pending orders. I just did it as an example.
I think it's easier to set up a two-dimensional array and sort by the first dimension. And there, accordingly, you can store what you need. In your case, the price.
I think it's easier to set up a two-dimensional array and sort by the first dimension. And there, accordingly, you can store what you need. In your case it's price.
So take whatever price you want. For pendants, take the opening price. I just did it as an example.
Suppose I have 10 bystop orders set. They are not set in order, but they are separated by time.
I need to delete the order which is currently furthest away from the current price.
Is this the correct way to find this order? -
//******************************
p.s.
I have inserted a function in the comment.
Comment( MiniMaxOrderPrice(NULL, -1, OP_BUYSTOP, 1 );
But it keeps returning "-1". Although there are from 5 to 10 orders on the chart.
there is a mistake somewhere...
I have, let's say, 10 bystop orders set. They are not placed in order, but are separated by time.
I need to delete the order which is currently furthest away from the current price.
Is this the correct way to find this order? -
//******************************
p.s.
I put the function in the comment.
Comment( MiniMaxOrderPrice(NULL, -1, OP_BUYSTOP, 1 ));
But the function constantly returns "-1". Although there are from 5 to 10 orders on the chart.
There is an error somewhere...
Comment( MiniMaxOrderPrice("", -1, OP_BUYSTOP, 1 )); // any symbol
Comment( MiniMaxOrderPrice(Symbol(), -1, OP_BUYSTOP, 1 )); // current symbol
OK! Thank you Vinin !
The function seems to be working! I'll look into it further!