Is there a way to configure the EA to wait for 3 consecutive losses and then enter orders?
-
@trader-philipps I'm looking forward to take this further. This is "linked" to something that I was researching, but maybe a different thread would be more appropriate to it. With your pre-latest modifications (didn't test the latest for now), live loss count, and virtual win count, it's practically almost done. At the moment, I'm researching how to add a chart subwindow, and plot a combined equity line, if you know what I mean :). Awesome project!
-
@cpxiom Go ahead and open a new thread. As ms specify how that equity line should look like.
-
-
This is a work in progress, as a variant to stop the live trades. Decided to keep it on this thread, as it's a continuation.
@trader-philipps Made a few steps further.
Managed to write pips difference in a Global Variable. Used a custom mql block, couldn't manage to do it with the yellow block. But this works fine, and it's not complicated.
Made an indicator that reads the Global Variable, and plots virtual pips equity.
Also the indicator has an MA for the virtual equity line.
Everything works great, except one problem. The virtual equity line is reset to zero, right before new value is fed.
I figure this issue is coming from EA (the figuring out one), because in order to calculate BuyOpen and BuyClose, there probably is a reset to 0, which is fed to the Global variable.
Don't know how to solve this.... tried with storage variable != 0 as filter condition, but it doesn't work... and maybe this is the case only for this EA (the figuring out one), so no problem for the final EA.
If not... anyone, please help
This is the updated figuring out project: https://fxdreema.com/shared/MTRaFRHgd
This is the indicator: 0_1575599188206_VirtualPipsEquity.mq4
-
@cpxiom Wow, you're quick!
Block to use in order to set global variables should be this one ...
.The rest of the project I didn'z understand from first read, but I have a guess ;-))
-
@trader-philipps I went trough a lot of trial and error, tried that one too, but settled at some point with the custom mql block. It worked, it's simple, so I went further.
That project is the same one with the trend lines which show the trades. I worked on this one, for testing purposes, so it's not important.
For what is worked on, only the last area is important. That's the only change.Problem is with that reset to zero of the virtual equity line. Why is that happening?
I tried to give a condition in the indicator also, with if global variable !=0, but didn't had an effect. Tried to filter in the EA also with same principle, but no effect. Maybe it has something to do with EMPTY_VALUE, don't know. Thinking if could use it somewhere instead of 0, or the other way around? Will research further tomorrow. -
@cpxiom Is the shared project link right? I don't see where you actually reset openprice or closeprice? Wher do you call your indicator? or do I need to put it to the chart by myself? I looked as this link https://fxdreema.com/shared/MTRaFRHgd
-
@trader-philipps Yes, the link is right, and the indicator has to be added manually in the tester. This can be done automatically via add template block on init, (by making a template with the indicator attached) but as this is just for testing purposes I kept the focus on what I was working on.
The reset thing... is just a "hunch" on what could be the problem of the equity line resetting to zero, every time before some new number of pips is fed, then plotted.
I'm not doing the reset, it's unintentional (not a block). Maybe I'm wrong, but I figured that -maybe- before new calculus the variables are reset to 0, and that data(0) is fed to the global variable... and as consequence the equity line from the indicator, is rising let's say +15 pips, then stays like that, then goes to 0, and then plots -5 pips let's say, then 0, then.... etc.
Although... this reset to 0 before a new subtraction calculus is normal behavior for the formula for the variable. So I will try to modify the indicator today, I tend to say that it's more likely that there could be the problem.
The covered steps are writing to global variable, and reading global variable from indicator. So problem is the plotted line. I tend to say now that it's the indicator... Will see today. -
@cpxiom Mabe for start beginb with a balance curve rather than an equity curve. That means you just update the realized profits or losses instead of equity change during an open trade. In that case the indicator can keep it's own calculations and you can just write + n pips or - m pips to the global variable. once the indicator picks that variable up, it could reset the variable to 0. That would work at least with one close trade at a time.
Later on you might have 2 buffers (or arrays) in the indicator. One for balance and one for equity (and maybe a 3rd one for open trades). In that case you can reset the equity to balance value once open trades equals 0.
What do you think? -
@trader-philipps Yes... I was referring to a "closed equity"(balance) line.
The "GV_vEq" is the difference from close and open price in pips. Didn't had time to work on this yet. And I'm not a programmer, so it's taking longer time than normally. Understand it a bit, but I'm a beginner at mql4. But, I have a habit... doing something until it works.
-
@cpxiom Passion is always a good attitude
