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
You can't do this to adjust Slippage for 4/5 digit Brokers, it just makes no sense.
Slippage MUST be an int, so a whole number, for a 4 digit Broker slippage is in Pips, so Slippage = 3 means 3 Pips, for a 5 Digit Broker slippage is in points, so Slippage = 3 means 3 points or 0.3 Pips. So to compensate, for a 5 digit Broker the slippage figure must be multiplied by ten giving 30 . . . 30 points = 3 Pips.
So this code is wrong . . .
Try this modified version of your OpenOppositeOrder() function . . .
Try this modified version of your OpenOppositeOrder() function . . .
Hi RaptorUk,
Before all thank you for help provided so far. Now The EA starts to work. I've done others modifications on how to close all if an order have profit and that is ok but as you already saw and predict for this strategy work is necessary that the order that reaches profit have the lot size increased to compensate for former orders. with that in mind I've introduced code to do that. So I'm dealing with a confusion here. I need to confirm if the last order had a profit or not and i want to use OrderProfit() in a way to adjust the next order lot size but, don't I need to close the former order to get that information ?
Here is the code to open an opposite order that's working fine(thanks to you) where I introduce the extra code to find if the former order that is open have a profit. Am I in the right way to get that ?
Thank you
Luis
Hi RaptorUk,
Before all thank you for help provided so far. Now The EA starts to work. I've done others modifications on how to close all if an order have profit and that is ok but as you already saw and predict for this strategy work is necessary that the order that reaches profit have the lot size increased to compensate for former orders. with that in mind I've introduced code to do that. So I'm dealing with a confusion here. I need to confirm if the last order had a profit or not and i want to use OrderProfit() in a way to adjust the next order lot size but, don't I need to close the former order to get that information ?
Here is the code to open an opposite order that's working fine(thanks to you) where I introduce the extra code to find if the former order that is open have a profit. Am I in the right way to get that
I suspect that this is going to cause you problems . . .
for example, if the result was 1.12316734 lots your NormalizeDouble() on a 5 digit par will change it to 1.12316 and this will not comply with the Lot Step requirement . . . . you need to use some mathematics to make your modified lot size a multiple of Lot Step MarketInfo(Symbol(), MODE_LOTSTEP)
I suspect that this is going to cause you problems . . .
for example, if the result was 1.12316734 lots your NormalizeDouble() on a 5 digit par will change it to 1.12316 and this will not comply with the Lot Step requirement . . . . you need to use some mathematics to make your modified lot size a multiple of Lot Step MarketInfo(Symbol(), MODE_LOTSTEP)
Hi RaptorUK,
Concerning your advise to look for maintain my lot size a multiple of Lot Step I'm looking to document myself about the subject.
now I've another issue (more one...)
To open the orders above and under the current price I want to use a line where once the Ea is start to running I compare the price with the the line that is still.
A first problem come; how can I compare the line with a difference in the price ?
Here is the code that I have so far. Here how can I give the name to compare because if I put out iHigh in after priceline it just doesn't work.
Thank you in advance fo any clues in these issues.
Luis
This just seems to not work at all (...)
I've put here the object delete, because I need that the line be deleted with the close of all the orders. am I correct ?
This just seems to not work at all (...)
I've put here the object delete, because I need that the line be deleted with the close of all the orders. am I correct ?
OK, I think I understand what you want to do, you want to check where Bid is compared to your line, to do this you need to get the position of the line . . . use ObjectGet() with the object name and object property index OBJPROP_TIME1 this will return the price that the line is placed at.
Your ObjectDelete() call looks OK to me. I particularly dislike the use of ObjectsDeleteAll() I think it is lazy and dangerous . . . or at the very least inconvenient for others.
OK, I think I understand what you want to do, you want to check where Bid is compared to your line, to do this you need to get the position of the line . . . use ObjectGet() with the object name and object property index OBJPROP_TIME1 this will return the price that the line is placed at.
Your ObjectDelete() call looks OK to me.
Hi RaptorUK,
I'm trying to close all orders if one close in profit, but when that happens a pending order is still open nevertheless the instruction to close is included in the CloseAll() function. Any clues about this issue ?
Thank you in advance for any help you provide
Luis
Hi RaptorUK,
I'm trying to close all orders if one close in profit, but when that happens a pending order is still open nevertheless the instruction to close is included in the CloseAll() function. Any clues about this issue ?
You need to understand how expressions work . . . you can't do this . . .
if(Op == OP_SELLSTOP || OP_BUYSTOP || OP_SELLLIMIT || OP_BUYLIMIT)
it's a similar situation to this one, but not exactly the same: https://www.mql5.com/en/forum/141790
What is the result of . . .
|| is a Bolean operator so only works on bools . . .
this results in a bool resultant value . . .
. . . if you wan to use a bitwise operator on your values then you can use this . . . .
. . . but it isn't what you are trying to do.
You need to understand how expressions work . . . you can't do this . . .
it's a similar situation to this one, but not exactly the same: https://www.mql5.com/en/forum/141790
What is the result of . . .
|| is a Bolean operator so only works on bools . . .
this results in a bool resultant value . . .
. . . if you wan to use a bitwise operator on your values then you can use this . . . .
. . . but it isn't what you are trying to do.
Hi RaptorUK,
I see, but now with that in mind I've modify the code and the pending order still there...
Hi RaptorUK,
I see, but now with that in mind I've modify the code and the pending order still there...
It can be if it has a different Magic Number than MagicNumber or it is for a symbol other than the symbol that the EA is running on or if it is a OP_SELLLIMIT or OP_BUYLIMIT . . . also, you need to check the return values from your OrderDelete() and OrderClose() calls . . .
Why do you need to call RefreshRates() ? I don't mean get rid of them, but can you explain why you are calling RefreshRates() where you are ?
What are Function return values ? How do I use them ?