modify a variable while earnig
-
hi again ,
i would like to know how to modify a variable after a gain
explain:
my ea start with 1000, after a close mi balance is 1050 , then modify a variabile ...
after 2 close mi balance is 1100 , then modify a variable.. ecc.......
so every 50 money modify a v .. that's possibile ?
in case of loss ... wait until the balance is X+50 -
Of course it is possible, but there is not a single way to do it. It's completely conditioned to your current project structure. Could you please share it for us to take a look?
-
@l-andorrà
[0_1568838591372_test.mq4]
link text
i tried this but dosen't work.. can you help me out please ?
in this case i want that after 49 earned , modify a variable -
First suggestion. Do you need all this to be calculated every tick? Because this is what is happening now! Maybe you don't need to be recalculating that info so often. Is the EA planning to change lots every tick?
Second suggestion. Both formula blocks should have a block ID number lower than 1195 (that of the condition block). Now your EA is trying to change the lots but calculating the variables AFTER having tried it. It should be done the opposite way.
-
@l-andorrà Good point. Instead of On Tick better use it in the on Trade tab and let it run when a trade is closed.
-
i tried to use lower id and move into trade ... but nothing, dosen t work... i m not sure that the formula blocks are set in the corret way... if you have to write an EA that works in that way, how can you set it up ?
-
couse, my problem is that i can tell to modify the variable every 50 $ of earn , but in case of loss, it take the old balance- loss.
es
start with 1000
at 1050, modify variabile (so after + 50$)
in case of loss, balance go lower to 950 ..
so the EA set the target at 1000 (950+50)
another loss? --> 950 (900+50) .............. -
Can you reupload your last version, please?
-
https://fxdreema.com/shared/0eOA2Rd0c
i'm pretty sure that i wrong with formula blocks... ok let' say :
1.
gross profit- gross loss = profit
profit should be the difference between profit and loss, so if lose 500 and i gain 550 then the profit will be 50
2.
initial deposit+ profit = baprofit
so if i start with 10000 , then baprofit will be 10050 ...
3.
equity+ baprofit
i gues, equity is the balance+profitable trades ...
so if the open trade is profitable , and it rise up the equity to 1050 , then modify a variable ....
that's corret ? -
@clacky And how do you deal with deposits and withdrawals and other transactions that may occur on your account?
I still don't understand what you try to achieve. Don't try to explain again with your 50 and 550 and so on. We all understand how profit is calculated.The thing is that there may be transactions on your account that will change your balance. Even if you go to trade history tab and choose something different than all history, there is a high chance that your logic fails. For instance if you switch the date to today, the EA only sees the transactions from today. Maybe there is a way to get around this with fxdreema, but I'm not aware of.
What about the idea to specify a constant in EA settings where you put your EA's start balance. If no other EAs are working on your acccount, you can easily calculate the profit or loss you have made by substracting the actual balance from the EA start balance.
If you have clipping levels for lot size, you may specify an algorithm such as 0.1 lot per 10.000 profit or something else.So what is your real intention?!?
-
Additionally, all your blocks are on the 'On Trade' tab now, but you haven't specified in which trade conditions are all those blocks to be calculated. That means that if no trade is open manually (are there any automatic trades planned?) nothing at all will happen.
-
@trader-philipps said in modify a variable while earnig:
If you have clipping levels for lot size,
ok, there we are, i was sure that my logic wasn't good, i just asking you guys wich logic to use in this case ...
i'm looking for a strategy where :when the EA find a profit, it ll change a variable. this is hard for me couse i have multiple trades, some loses,some wins, but when the wins are more than 50 $, then do this hard action.
then reset, and start again the logic .
i'm a beginner, i'm not english... have patience please -
@trader-philipps
anyway the last part of your reply seems smart and cleaver ... i will try it, thanks !
ok mybe i figured it out.. let me check -
thanks for your help