Hi Mladen, hope the market has been treating you well, and a merry Christmas to you. I haven't bugged you for a while, thought I bug you one more time before the year is over.
Please see the above 3 files.
1. VQ Zeroline Histo has an averaging parameter which both the candle and tape indicator does not have. I would like for you to have the averaging parameter coded into both the candle and tape indicator. And the reason is...
2. I would like all 3 VQ indicators to have the following color changes. The color formula would be as follows:
- above 0, ascending, above average = Blue
- above 0, ascending, below average = Dark Blue
- above 0, descending, above average = Dark Blue
- above 0, descending, below average = Dark Blue
- below 0, ascending, above average = Dark Red
- below 0, ascending, below average = Dark Red
- below 0, descending, above average = Dark Red
- below 0, descending, below average = Red
3. Finally, alerts to be added when values crosses above or below averages.
Looking forward to it. Thank you Mladen!!
If I understand correctly you wish to have 4 states (colors). Am I correct?
PS: if it is 8 conditions and making alerts on all 8 conditions would make it almost always alert (that would be a possible 16 types of alerts). I doubt that it is the intention you had in mind (even 4 states can have possible 8 types of alerts)
Dear Mladen, yes, 4 state colors would be good enough. That means the following.
With alerts, the same for all 3 indicators, thanks Mladen!!!!!!!
Can you please take a look at the attached order management EA I coded to manage orders placed with a script ? It is supposed to work this way: you input the number of pips for stop loss, take profit, and trailing stop. If your order hit stop loss, it will close the order. If your order is in profit and above take profit level, it will close the 1st half in profit and move stop loss to break even and trail the 2nd half.
The problem is, it doesn’t work properly when you input pips for trailing stop as 0. If you input trailing stop pips as 0, it is supposed to close the 1st half in profit, then immediately close the 2nd half. However, actually it doesn’t work the way it’s supposed to. I placed an order for AUDCHF of 0.38 lots. When the order hit profit target, it closed 1st half, which was 0.19 lots. Then it was supposed to close the remaining 0.19 lots immediately. However, it did something different. It closed only 0.09 lots. Then it closed 0.05 lots, and then 0.02, 0.01, 0.01, and 0.001 lots. Please find attached the transaction history and journal message.
Can you please fix it for me ?
By the way, I have a question about global variable. How many global variables are we allowed to use in MT4 ?
Thank you in advance,
The problem is simple : how can the EA know that it already closed a half if it does not know what was the initial size of the order? If the order sizes traded are not fixed size (so that the EA exactly knows at which step the order is currently) there is no way how the EA can "know" that it has been closed partially already - comment part of the order info can not be used for that)
The only solution is that the initial order sizes are fixed sizes and only then the EA can do what you are intending to do
Acutally I already factored it in and used a global variable "Gstatus" to let the EA know if it has already closed the 1st half. "Gstatus" is initially set at 1.0. If the EA closes the 1st half, it will change the value of "Gstatus" to 2.0.
However, it still doesn't work properly when the trailing stop pips is 0.
Mladen, would this be a 4 state color?
Yes it would be a 4 state color
will have to test it to see exactly what is happening, when and why
I checked the EA some more and might have found where the problem is. When the EA closes the 1st half, MT4 will assign a new ticket number to the 2nd half. However, my EA doesn't know that and still searches for the old ticket number to close when it needs to close the 2nd half. I corrected this and hope the new version will work. Will test it on Monday.
Happy New Year !