Did you do it like this:
https://fxdreema.com/shared/1WVco5iZ
Posts made by roar
-
RE: CLOSE BAR HELP!posted in Bug Reports
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
I think the trade statistics always looks at the whole history, so you wouldn't be able to focus on some x number of history positions
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
I just realized the above is partial bullshit. Multiplying the profits doesnt work because we check it against average value. But its a start, at least
Dividing the currentprofit should work
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
@timmyhanke
So the question is, how to get the loss values from history positions.I would store the current profit, to some variable currentprofit
Because you compare many trades to one trade, you need to multiply the currentprofit with the number of last trades before continuing - just use a formula. In the formula I would also multiply it with *-1, so it can be compared to a loss.
Then use the "check profit (average)" block, set to look at x number (number_of_positions) of history positions, and compare the average last profit to the currentprofit
https://fxdreema.com/shared/D382vaNlc
This is just a fast mockup, how I would do it, perhaps there is a better way. To be honest, I haven't used anything like this, because I try to avoid making decisions based on profits and losses, and rather focus on actual price data.
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Yeah, that would work

-
RE: Give my variables eternal lifeposted in Questions & Answers
Yeah, I went with the global variables, but it feels a bit clumsy solution, and makes a really weird interference in my backtest.
The file approach would be better, I guess its time to learn some actual MQL coding
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
^This is exactly why I like to help

If you need further help, I'm usually bored enough to assist

-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
I downloaded your .ex4 and added 111 pips SL, heres what I got:

-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
It should work technically, but the logic is now so that there must be profit in order to make anything happen - otherwise the ea just waits and hopes the profit to show up

Try with an SL -
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
I modified it to work with profit, which, I think, you wanted in the first place
here: https://fxdreema.com/shared/c2mQcANde -
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Mine works now, it closes trades when equity drops 10%...

-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Oh, sorry didn't know that

Yes, youre right -
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
This method doesn't actually precisely answer to your question, because it works with account equity, not profit. But with some changes, the method can be applied to the profit, loss or anything you want
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
After closing the trades, you need to reset the maxprofit to 0 - otherwise the logic works only one time.
Check how I did the resetting in https://fxdreema.com/shared/6FWqaYX2b
Block #5 -
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Aaa, I found the problem!
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Ah, I use mt5 myself and comment works fine.
No, the comment block is just for you, for debugging
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
In condition five, I set the Ratio to be lower than 0.9 - check your terminal that the value (inp4_value) really is 0.9. You can also try some different ratio value, maybe that helps.
Does it close everything constantly, if you disable the whole variable block tree? -
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Hmm, did you use the comment block, to view how the variables change?
Care to share the project so I can check
-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
Yes, thats how you set them up.
You dont usually need to give them any values different than 0, because the ea updates them anywayAnd the names "maxprofit" and "Ratio" are just pulled from the hat, the code doesn't really care what you name them of course

-
RE: Total profit reduces by x % then close everything.posted in Questions & Answers
It's useful to see what the variables are at each moment - the comment block is for that