In my code expression 2 is j >= 0 meaning . . . while ( j >= 0 ) so the loop executes while j is 0 or greater, i.e. from OrdersTotal() - 1 down to and including 0
If you use j = 0 (maybe it would have to be written j == 0) it means while (j == 0) and the loop only executes when j is 0
The first order position is 0 so if you have 5 orders the positions are 0, 1, 2, 3, 4 . . . so the last is OrdersTotal() - 1 . . . so to count down you start at OrdersTotal()-1 and end at 0
Does this mean that OrdersTotal () -1 is No Orders , then 0 is 1st order, 1 is 2 orders and so on to 4 which equal the 5 orders.
Would someone let me know if my understanding that -1 is equal to No orders , is this correct ?
I also need help concerning the same issue. I'm a novice coder and I've been trying to input the code I saw here but its not working at all can you help me. The Orderselect was used
to replace OrdersTotal and control number of trades each EA makes but now the others won't place trades
In МТ3, management of open positions was rather time-taking. Traders had at their disposal a rather limited tool set to work with the list of open and closed positions. The problem of distinguishing between "own" and "someone else's" positions was solved in rather complicated ways. In МТ4, the situation has cardinally changed. Now, trader can...
b and bM are local variables. Ticket numbers are lost when you return.
Why are you trying to select by position, but trying to store ticket numbers? If you select by a valid ticket number that doesn't mean the order is open.
You buy at the Ask and sell at the Bid.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger at a specific Bid price, add the average spread. MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.) Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
The Chosen #: Please can I use this code in my project
If I am not wrong, anything posted on forum is free to use...
You could mention the source in your code, but I would guess that is in fact up to you, as long as you do not publish on code base. For code base, I suggest, if it is a major part of code, you at least mention the source in the code somewhere.
It will make it easier for people (and you) to backtrack your work.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
You are dead wrong. Your code never gets executed !!!. Use RaptorUK's.
Okay :)
I simply got confused by this:
"finish when j = 0"
thanks!
So it should look like this:
because you wrote this:
or am I wrong?
You are wrong . . . take a look at this: for
In my code expression 2 is j >= 0 meaning . . . while ( j >= 0 ) so the loop executes while j is 0 or greater, i.e. from OrdersTotal() - 1 down to and including 0
If you use j = 0 (maybe it would have to be written j == 0) it means while (j == 0) and the loop only executes when j is 0
No, do this . . .
The first order position is 0 so if you have 5 orders the positions are 0, 1, 2, 3, 4 . . . so the last is OrdersTotal() - 1 . . . so to count down you start at OrdersTotal()-1 and end at 0
Does this mean that OrdersTotal () -1 is No Orders , then 0 is 1st order, 1 is 2 orders and so on to 4 which equal the 5 orders.
Would someone let me know if my understanding that -1 is equal to No orders , is this correct ?
Thanks
Does this mean that OrdersTotal () -1 is No Orders , then 0 is 1st order, 1 is 2 orders and so on to 4 which equal the 5 orders.
I also need help concerning the same issue. I'm a novice coder and I've been trying to input the code I saw here but its not working at all can you help me. The Orderselect was used
to replace OrdersTotal and control number of trades each EA makes but now the others won't place trades
&& res == falseOrderselect will return true if it selected an order.
Maybe you can use a magic number in combination with the symbolname.
Here is an example in article you can study: https://www.mql5.com/en/articles/1359
b as no value, OrderSelect fails. bM as no value, OrderSelect fails. s as no value, OrderSelect fails. sM as no value, OrderSelect fails.
You buy at the Ask and sell at the Bid.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger at a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
Code it like this :
Please can I use this code in my project