There is also a block "Check profit (period of time)". Initially I made this block for people who wanted to check the profit for the last day, but with the options that I added you should be able to select any period of time.
Posts made by fxDreema
-
RE: How to calculate profits for current day, current week and current month ?posted in Questions & Answers
-
RE: auto lot sizing issueposted in Questions & Answers
So there is something called lot step. For example, if the lot step is 0.01, you can open 0.01, 0.02, 0.03... lots. If the lot step is 0.1, you can open 0.1, 0.2, 0.3 and so on. Lot step is the difference between two possible lot sizes. If you try some middle value, for example 0.012345, it will give you an error. So the EA that is generated would always use possible values. If your balance is 2641 and the lot size is calculated as 0.02641, this value is then rounded to the nearest possible. I guess that I used MathRound(). But as roar wrote, you can always write your own function. Some functions that you can use are AccountBalance(), AccountEquity(), MathFloor(), MathCeil() and MarketInfo() if you want to get the lot step. Take a look at their description in the documentation for MQL4 in MetaEditor (Help -> MQL4 Reference)
-
RE: Backtest problemposted in Questions & Answers
I would also blame the history data. I'm not aware of anything in the code that can change the behavior of the Tester. Almost everything in the code happens in that OnTick() function that is automatically called by the Tester on each tick. So it's the Tester that is preparing the ticks data before even start testing, and then using that data to call OnTick().
Just in case, you can try another EA... even EA downloaded from internet. I think you should see the same effect on any EA. But if you see it only on FxDreema EAs, then this obviously means that the problem is in them and I need to investigate it.
-
RE: Variables are changing after update in formula blockposted in Bug Reports
Weird problems are possible of course. I think the letters ATR in one of the variables have something to do with this, because in the other topic they have a variable containing ATR as well. I also made my example here: https://fxdreema.com/shared/r9zXidGDb - but I don't really know what to do to cause the problem to happen. It should not be completely random, there should be certain order of actions to cause the problem... but what are these actions
-
RE: Current Lot sizeposted in Questions & Answers
In your example I see you are doing something with the objects that are created by the EA, but I don't really recommend to use the data from them.
And yes, try "For each position". In case you don't know, in netting mode you can have 1 position per symbol. This block would load only that position if it exists. In its filters by default the current symbol is used (the value is empty, which means the current symbol). It's also possible that you can even omit this block and still be able to load the position in 203, but I recommend using "For each trade", so it can be clear what is going on. And yes, as it was said, block 203 doesn't work now in this example only because it is not connected to another block.
-
RE: Make EA close all trades when balance is below 10%posted in Questions & Answers
No, no, no... don't add one of these "inp..." things in Constants. And don't use == when you compare prices or money. Use anything else, but not ==.
10%, but 10% of what? Balance is the amount of money you had the last time you had 0 opened orders. Close all opened orders and the Balance is equal to Equity now. Do you really want to compare Balance with Equity?
10% sounds to me like such a small value that you should not reach it so quickly. If Equity can be less than 10% of the Balance, this EA is not good from the start.
If you mean 10% from some initial value... for example you can deposit 1000 dollars and you want to close everything when you reach 100 dollars, even if this is 6 months in the future... then the problem is that the EA can't really know what is that initial value that you had in mind half a year ago. There are ways to remember values for a while, but in this case maybe it's better to hard code the value in the EA
Otherwise you can try something like this:

Remember that here Equity and Balance are those global values that are result from all trades.Or this one:

Here this block calculates the profit from the running orders only, it doesn't care about closed orders. AccountBalance() gives you the balance. This is function from MQL4. There is also AccountEquity() and other functions.
So, let's say the we have initial deposit of 1000 dollars. This is the Balance. Then we start losing and the block calculates that out profit is negative. The block would pass if the profit is < 20, because -1 * 1000 * (0.02) is 20. I made my tests and it was easier for me to close the trades when the loss was below 98% of the balance, that's why I used 98 there.
Note that the values used there have .0 at the end. Apparently, if you do it like this (100 - 98 / 100), the calculation will fail, because in MQL4 these numbers are integers and the final result is also integer. The result can't be 0.02, it will be 0. To get the result as floating point number, I wrote these numbers as floating numbers. -
RE: i don't why my indicators are not working on mt4posted in Questions & Answers
I can see that you have 2 custom indicators. I can't find something wrong with their definitions and I'm not sure what is the problem. I can say that it is important to have all input parameters with their correct data types and correct orders. The names can be different, but each name should look like MQL variable name.
There is one known bug in FxDreema. You can see there are few extra parameters for each custom indicator:

Each one of these parameters have some name. At the end the names of the indicator's parameters and these parameters are merged. Problem happens when the name of one parameter of your indicator is the same as the name of one of those system parameter names. For example this one on the picture is named Period. There are few others - IndicatorBuffers, Symbol, Shift, ModeOutput and some others. These who cause problems are normally Period, Symbol and Shift. So if you have parameter with one of these names, rename it to something else... MyPeriod instead of Period... anything like that. -
RE: Licensing ideasposted in Questions & Answers
I'm not sure if the WebRequest() function in MQL supports HTTPS. In the documentation they used the word HTTP only. The problem is that if you make this with HTTP, I can easily make a redirect to my local server and respond to any requests from the EA in any way I want. It's not very secure. With HTTPS not only the messages are encrypted, but also the identity of the destination server is checked.
Otherwise if you don't know what GET is, this is for example when you request the website from the address bar. Key-Value pairs can be send in this format: http://example.com?key1=value1&key2=value2&key3=value3. The whole request is in this address string and there is some limit in the length of the string. POST is another method, it's a little bit different. All web servers can handle GET or POST requests.
-
RE: Closing trade based off different indicatorposted in Questions & Answers
I notice you have two blocks one after another who have x< and x> inside. Take a look at how the crossover works in these blocks: https://fxdreema.com/tutorial/builder/crossover The problem when you have 2 crossovers in 2 blocks connected one after another is that it is expected the crossovers to be true at the same candle. When you are using different indicators, this is normally not the case. So, what you can do is to use just one crossover and use > or < in the other. The idea is that if line A is > line B now, then surely line B crossed line A some time ago. Maybe one candle, maybe 10 candles... the question is do you care how much candles.
If you still want to wait for one crossover to happen and then wait until the other, try this on the block you want to wait:
But even if this option looks promising, I found out that when I use it, I only get lost. If you resolve some problem with it, there is a chance to create some other issue. For example, what happens if certain block is waiting for its crossover to happen too long and meanwhile in the strategy you no longer want to create a trade 
-
RE: How can I ensure that only 1 trade is made per day?posted in Questions & Answers
Try something like this:

Here I load the last closed trade, then I check its age. This is the time since it opened or closed, you will see these settings in "check age". -
RE: Where are my screenshots?posted in Questions & Answers
For sure, MQL5 is much more crazy.
So, most of the time the screenshot has height of 102 pixels, but the width is right. I wonder, do you have something around the chart that has the same height? My idea is that even if the height is wrong, it has some size and this size might be coming from somewhere.
-
RE: How can we display the profit ON chart after a closed trade?posted in Questions & Answers
@roar This will output OrderProfit() as a string. Better use the other "Text" option:

-
RE: detect vertical lineposted in Questions & Answers
The logic for this is easy - you need to start looking at the objects and for each one of them to find its Candle ID (shift) and check if it is between 1 and 3. Ideally, when you reach the desired number (you want to find at least 2) you need to stop searching for more (the loop needs to break).
Here is what I made: https://fxdreema.com/shared/mOnIB2tqd But I use few blocks + one variable for this, and I don't break the loop. So this is not the best way to do it, but it will work.
-
RE: Compilation errorsposted in Bug Reports
The problem is because of the letters P3 in TP3_Pips. If you look on the left side, P1, P2, P3 and other Px can be used in the same way as V1, V2 and so on. So basically the P3 letters in TP3_Pips are replaced with something that doesn't need to be there.
Anyway, I added some code in few regular expressions and I think I fixed this problem. But if you will need to save the block again.
-
RE: Desktop errorposted in Questions & Answers
So yes, it was the NodeJS version. I tried to make it work on the latest version that I installed, but nothing worked. I installed older one where it works.
-
RE: Desktop errorposted in Questions & Answers
It's not about ExeOutput anymore, the whole website is NodeJS now

It's strange, my desktop version also cannot connect. It tries to connect to a certain address and when I try that from the browser, it's all fine, but the desktop program fails. I don't remember changing something in the code on the server, but I do remember that one day the website failed and while I was trying to fix it, I installed new version of NodeJS. I will investigate this problem
-
RE: OnTick critical error when change brokerposted in Questions & Answers
I don't know. It doesn't look like brokers' fault, but I wonder why a problem would happen in this block at this place. If you put Print(token) at this place, what will be printed in the logs? Or Print(index)
-
RE: i need help martingaleposted in Questions & Answers
Maybe placing pending orders with every new trade? But if you are not closing the losing trade and you are trying to cover the loss with opposite trade with bigger lot size, I think that it's better to just close the losing trade and open new one with smaller lot size. What you are doing smells to me like hedging, and I think that hedging is just a stupid way to make the EA over complicated

-
RE: Draw Trendline and Swing for support and resistanceposted in Questions & Answers
@l-andorrร said in Draw Trendline and Swing for support and resistance:
This is my weakest point on fxDreema. I am also interested on how to do that.
Exactly. When I'm trading (manually), I always draw trendlines, they are one of the most used indicators for trading. Once I actually started writing code exactly for that - to find where the trendlines should be. But they are not something that is straight forward, everyone can draw his trendlines differently. Or, if a program draws them but some rules, someone can disagree with these rules. So I think the answer is to find some indicator that prints these. It will probably have bunch of input parameters