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
This is not what i want. you misunderstood my question.
Regarding the percentage calculation and if condition, it already short out. My current error is while writing the values in the file. So even when it Deinit and OnInit, it will remember it values instead of replacing to new one without fulfilling existing value/Profits.
What do you need the file for? My example determines the fact of achieving a given percentage of profit without using files and global variables
What do you need the file for? My example determines the fact of achieving a given percentage of profit without using files and global variables
This is what i want :
Account Balance = $1000
Target Percentage = 10% (10% of 1000$ = $100)
When Account balance is above $1100, close all the running trade whether it in positive or negative. Than it start again but now the Account balance is $1100 and 10% targeted percentage is $110. and it keep repeating.
---x---
I am not comparing Account Balance and Equity because value change on each Tick. I want, complete the target and close all running trade if any, rewrite the value, repeat again every time. And i have already made the code which working as i want but the only error is if any how my EA got Deinit and when it reinit it value redefined without fulfillment of existing value.
This is what i want :
Account Balance = $1000
Target Percentage = 10% (10% of 1000$ = $100)
When Account balance is above $1100, close all the running trade whether it in positive or negative. Than it start again but now the Account balance is $1100 and 10% targeted percentage is $110. and it keep repeating.
---x---
I am not comparing Account Balance and Equity because value change on each Tick. I want, complete the target and close all running trade if any, rewrite the value, repeat again every time. And i have already made the code which working as i want but the only error is if any how my EA got Deinit and when it reinit it value redefined without fulfillment of existing value.
Forum on trading, automated trading systems and testing trading strategies
Target Revenue in Percentage using Account Balance and Equity
anuj71, 2024.02.29 07:22
To do this, i am trying like :
I still believe you still did not understood what i am really looking for.
For example,
Account Balance = 1000
Account Equity = 1200
double profitCurrency = equity - balance;
1200 - 1000 = -200
Now, let say some trade got closed in profit. $50. Now account balance is 1050 and equity is $1400
1050 - 1400 = -350
Problem here is, it never meet the condition because the value of profitCurrency is floating because Account Balance and Account equity change on every tick. I request you to please check my this code https://www.mql5.com/en/forum/463287#comment_52562520 , so you can understand what i am really looking for....
Forum on trading, automated trading systems and testing trading strategies
Target Revenue in Percentage using Account Balance and Equity
Vladislav Boyko, 2024.02.29 18:37
Close the order if its profit is 10% of the balance
In case of several orders, use the total profit of several orders, as I wrote above
Account Balance = 1000
Account Equity = 1200
1200 - 1000 = -200
200, not -200