Use the Balace at 10 pm the day before as variable
-
Hello,
How is it possible to set the balance at 10 pm from the day before as variable. So I can say the EA has to stop running when Equity is 2% above or below the balance the day before. The EA should work again when the next day begins until equity is at the specified level and so on... please help! -
@floko125 I’m not sure the specifics but I would think you would have to make your EA stop at 10pm with the time filters, then make a condition or variable that the EA automatically stops once the account has grown by 2%. Is that what you’re looking for?
-
@floko125 Ok so you would need to do time filter for when your EA will start and stop. Then use a check profit for the 2%
Hopefully this thread should help too
https://fxdreema.com/forum/topic/10689/daily-target/2 -

Look, if I set variable _1 as the balace in the night it only should allow trades in the range between - 7% loss and +7% profit and close all trades if it went out of the range. The problem is when I try to backtest it, no trades are executed. If I set conditions with a specified amount like 20000 and 18000 it does work, so there is a problem with the variable. Any ideas?
-
@floko125 Hopefully the gurus can help @roar @l-andorrà
-
@floko125 please make a shared link

-
-
@roar At the moment I have to manually set the limits but I want to have this done automatically to have the ability to backtest it.
-
@floko125 You need to store the value of balance first by using a variable:

Once the value is stored, you can use it later to do as many calculations as required.
-
@l-andorrà
But how can I make the EA automatically start again when the next day begins, Sir?
https://fxdreema.com/shared/G2y8sT1xc -
@floko125 use "once per bar" and set the timeframe to daily. Put that block between "time filter" and "modify variables"
-
NO Set Stop EA
Use No Open Order OR NO Run Code
-
@roar When I do so, it generates the output "constance expected". But even if I use constance instead of variable, the strategy does not generate trades at all when I put the "once per bar" into the EA.
-
@floko125 remove check marks:

-
@roar Still not working...
-
https://fxdreema.com/shared/h4Q72E1Oc
Inputs Add : Equity
Variables Add :
Mark_Balance
Mark_Balance02
Mark_Balance03
Mark_Equity01
Mark_Equity02 -
@roar @l-andorrà
To specify my problem:
I want my EA to set daily limits for profit and loss. These limits should are a specified percentage of the balance at 22:00 the day before. When the profit or loss limit is reached, all positions shuold be closed and no new positions should be open. But the next day the EA should work normally again until one of the limits are reached, and so on... -
@rahim-1
Wow, this is awesome
I will check if it works, thank you. -
ok ......
-
@rahim-1
It seems not to work in backtest. Maybe it is because I am using MT4?
Also I saw that there were the warning "implicit conversion from number to string" when I compiled it.