Miro1360, Please Help, Button informing the current profit. (Solved)
-
miro1360, I need help, I want to put a button that informs me of the current profit of all open operations in the Pair where the button is, at the same time if the profit is positive the button will turn green, if it is negative it will turn red and if it is "0" in gray. I say button because I do not want a text on the screen without more, I want it to be seen inside a box, so I think that a button would be the most appropriate. I have reached this point but the text, or data does not come out and I do not know how to add the open operations and if the total comes out in the current Protit of the pair. Please, Help. Thank you very much and sorry for my English.
-
Hi, try something like this:
https://fxdreema.com/shared/fHVCdImHc -
@fenixtrading Thank you very much but i get the button only in gray and it does not change color, nor does it give me the current profit, it stays at "0"
-
This version is actually working:
https://fxdreema.com/shared/Ne8Z35hdd -
@fenixtrading Hi Fenix! Thank you very much, it is perfect. One more question, do you know if by copying the MQL code I can pass it as an indicator instead of EA to MT4, or on the contrary, how could I pass it as an indicator?
-
@xyon126 You can try it by copy and paste the same code in MetaEditor.
FxDreema should allow us to program also Indicators with the same system. -
@fenixtrading OKAY! I will prove it. Is it possible to limit the decimal places that instead of leaving 6.5300000001 you get only 6.53 or 6.5?
-
I added a DoubleToString funcion in the button block.
If you prefer less digit just change the last number from 2 to 1 or even 0. -
@fenixtrading Sorry, I'm very clumsy. Where and how should I change the double variable to string?
-
@xyon126 i have updated the EA
https://fxdreema.com/shared/QIeBYiIQcOpen the Button Block, check the DoubleToString funcion and change the last number. You can choose how much digit to show in the button.
-
@fenixtrading Thank you so much. Just one more thing, I have tried it in different pairs (EURUSD, EURJPY, etc) and I have found that the Profit that it gives me is not the one of the PAR where the button is but the sum of all the pairs and I need it to be only of the total of the pair, that is, if the button is in EURUSD that is only the total of the EURUSD operations and thus in each PAR that the button puts. It's possible?
-
@xyon126 I think it's possible, but you need different formula for the single pair. You just need to isolate a bucket of trades and calculate the netprofit.
Also you should create a loop for trades in the specific pair you load the EA so you can calculate and show the net profit on the button. -
@fenixtrading How can I get the PAR where I am? I think that with the Block "Set" Current Market "for next Blocks" with a variable that gives the previous data it would be possible too. What do you think?
-
@xyon126
It could be interesting to know how you open and manage the trades on a certain pair.
Let's say you manage your trades with loop event, this version should work on a single pair. -
@fenixtrading
Hello! It does not work, what gives is the historical not the current Profit. I just tried it.