Turing Off EA after set $/Pips made
-
Well, Variables are not that hard. I'm not saying that one should use them for everything, but if there is one task that does not exists as a block, why not? Variables are just some names that hold some values. The most complicated thing about them is their data type, but even this is not that hard. The one that is mostly used is "double" - this is for numbers.
I don't even recommend to use many Variables. I have seen some people using big list of Variables, but I think this makes everything much more complex, because you need to remember more things. But 1-2 Variables... this is almost nothing.
There are obviously some situations that the only way is to store some information in a Variable, like your situation. There is no way to know what was the Equity few hours in the past, because there is no history of Equity prices. Candles are some sort of history prices, but there is no such thing for Equity and Balance. Well, if you keep at least 1 trade opened, then Balance is actually a history value of Equity. Otherwise if you want to remember the value of Equity for later use, how can you do that? You use Variable. Again, there is no block that does something like "Give me Equity at 02:34", only because Equity is not something that MT automatically keeps into a history database.
Other things can be get from MT's database, things like candle prices (OHLC, Time and Volume), indicators data (which is modified version of OHLC), parameters of all orders and trades (SL, TP, Lots, OpenPrice, ClosePrice and others...). These values can be get from the past without using Variables, but sometimes the EA can be made faster if you store some of them in a Variable and thus make something like cache.
-
I'm sitting here banging my head on my desk in confusion so I decided the read this thread from the first post to the last and I realize that for almost two weeks it reads like two people having two completely different conversations.
So lets start again, and I will focus more on trying to figure out how to use Variables and less of trying to get some useful blocks made.
So I assume we both know what my desired action is. so lets break this down sections.
-
how to figure out how to calculate what the earned or lost pips are.
-
I assumed this could be done by looking at Price. So I used your example with "LastStoredEquity" but used Market properties/Ask,Bid,Mid/Ask and I called the Variable "SnapPips (Block- Modify Variables - Start of Trade Price) and put it following a "Buy Now" block so it would only see it once when trade was opened.
-
Next made a Variable named "LivePips" (Block- Modify Variables - Live Price) with the same Market Properties and let it hit every tic.
So now using the Comment block I can see both numbers. -
Next, and here is where the train starts to come off the tracks, I want to see the total pips for the current trade is, so I used a Formula block to subtract SnapPips from LivePips and "Put the results into this Variable: CurrentTradePips" to see the total pips earned or lost.
I tried using Terminal Variables (This is NOT for Variables)/LivePips-SnapPips, but i would assume that the part where is says "This is NOT for Variables" is the reason that it didn't work. I also tried using Value/Numeric/V1-V2 (because I saw it listed that way in the Variable tab on the formula block) with no luck.
-
So in the spirit of going step by step, unless you think I'm on the wrong path, what would I use in the Formula block to get the difference between the LivePips and the SnapPips variables?
See my EA - Variables
-
-
Pipologist, this is absolutely true for me, sometimes I don't understand people or I understand them wrong
I guess that something is now wrong with me after few years of programming and answering (mostly the same) questions over and over again. I prefer short and direct questions instead of long long stories. When I read long stories, everything I am thinking is "This person should try to write this in 1 short sentence... or in code :D". Also, english is not native for me and very often I completely don't understand what people want to say. Sorry about these things 
Then, when I respond to one question, in only few minutes I will completely forget what was the problem of that person. I don't know if you can see, but now when I enter the forum I have to answer to about 10 questions of 10 different people. Plus some questions in the email. And sometimes I got personal messages here. I guess I started to give failures already

-
And what happens when I see problems in people's projects unrelated to their question...
http://prntscr.com/ad9ufw
http://i.imgur.com/sKHP9yX.pngYou just wrote that Terminal Variables are NOT to be used, and this is true. That's why I added this warning This is NOT for Variables. Terminal Variables are to be used in other situation and here is more about them:
https://fxdreema.com/help/-/working%20w ... 0variablesVariables should be places in Value -> Numeric (or String, or whatever...)
Another issue. Blocks 6 and 30. Connected this way, block 6 runs before block 30. The same goes with all the other "parallel" connections. Just make sure that everything is connected properly. Connect blocks one after another when possible, this is how you can be sure that one things really follows another.
Now what was the question...
-
How do I subtract Variable SnapPips from Variable LivePips and put that value into Variable TotalTradePips
-
Instead of "Terminal Variables", go to "Value -> Numeric" and put variables there. Very similar to "Label 1" in block 4 here - https://fxdreema.com/demo/mt4-variables
-
Block 5 is not putting the result in Variable "TotalTradePips". why not?
-
Please, take a look at this example again and find the difference in "Comment" - https://fxdreema.com/demo/mt4-variables
-
I want Variable "TotalTradePips " value to be added to Variable "PipHold" value every time Block 5 is triggered.
so it Variable TotalTradePips Triggers 3 time at 10 16 and 14, Variable PipHold value should be 40.
How do I do this?
EA Variable
-
I can see in your projects that you have found one way to do that in Custom MQL4 code. That increment by itself should work.
-
That's great information, but since I asked the question you can probably figure out that it did not. so what can I try now.
-
Even if I answer 10 minutes later, the person may try something meanwhile and find the answer.
There are many ways to modify Variables - https://fxdreema.com/demo/mt4-variables I tried this example and it works. Well.. for some reason in the Tester the comment section is not auto-updated, probably because of the Delay block, but if move the chart changes can be seen. -
I have given up on this. I am up to 10 blocks and it still doesn't work correctly , and that is just the math for long positions not shorts. all that for what should be 1 or 2 blocks
The bottom line is that I am just not that smart, so I can not figure it out. As I said before, I am not a coder that is why I use Fxdreema.
With the exception of you teaching me a little about Variables, that was a waste of 3 weeks of my life that I will never get back

Here is what I have so far if anyone wants to continue with it:
https://fxdreema.com/shared/AlJIi6rFc
If you ever make the blocks like you said in you were going to do in your first post of this thread please let me know.
-
Check profit (period of time)
Check it out. Tell me if you like it's name and the names of the neighbour blocks. I decided to rename them, but I'm not very sure... And this block now is pretty slow. But this is the thing, more options = less speed

-
@wadz91 You can find some inspitration here maybe:
https://fxdreema.com/shared/KoZ4XoeUd
It doesn't turn off the EA but it stops trading until the next day.
-
@l-andorrà tHANKS WORKING ON BUT IM NOT EXPERT

-
@l-andorrà I did able to figure out see below but I think something is missing.
Please note: When I backtested 6 months it placed only 1 win trade over 10 pips in 6 months.

-
@wadz91 Can you please share the link instead? That will make it easier to review.
-
@l-andorrà Hi the link is https://fxdreema.com/shared/Kc2S2Ueob
-
@wadz91 Your logic is correct. This means the reason for so few trades must be in the conditions required to open a new one. Maybe they are too restrictive.