fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    self updating/refreshing grid, compare two groups of trades

    Questions & Answers
    10
    449
    423928
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      ramsay09 last edited by

      I still don't what is wrong with the EA but I have found out the problem is not the complexity of the EA. I have reduced EA to a very basic level and it was still not working. https://fxdreema.com/shared/A3iA8pgkc

      You don't have to understand and reorgenized EA in my opinion but try to fix the basic EA which is easier to understand. If the basic EA is working I am sure the more complex EA would also do. On backtest erverything is working there are no problems at all. On demo account EA was working since you have changed the "once per trade/order" block. What did you have found out until now?

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        Now "once per trade/order" blocks works only for trades/orders created after the EA was started, not for older ones.
        I just added this EA to see what is going on, and on my live demo account the value of grid_space_factor is something like 60, which is bigger than the 50 pips required to close the trade on profit, so maybe this also makes some difference.

        1 Reply Last reply Reply Quote 0
        • R
          ramsay09 last edited by

          I have replaced "once per trade/order" block on my current EA but it is still not working (the very basic EA also was not working). Did you verify the very basic EA was working on you account? I don't think the grid space factor or denominator value are the reason for the problem.
          To see faster if EA is working you can chose grid-denominator = 100 then you get grid space 3-10 pips and market will hit that level faster. What I do not understand is that everything was working an becktests and on live demo account I was running the basic EA for 3 weeks and the grid was working fine. Only the restart was making the mentioned and already solved problems.

          I would like to go on live demo for some time to get more experience with EA and get some inspirations for further developement. Could you fix the problem and verify grid is working, please (maybe the reason is FXCMs last spread change if EA is working on you account).

          1 Reply Last reply Reply Quote 0
          • fxDreema
            fxDreema last edited by

            Normally I turn on and off MetaTrader and charts all the time, if I have to wait hours and days to see if a strategy is working live...

            Here is how to detect when there are problems:

            • You are not sure if/when a block is passing (orange output goes active) - just connect "Draw Arrow" after the orange output.
            • You are not sure about some value? Use "Indicator tester" block, it will draw a line on the chart, which will be the history of values. Additionaly, it will print the values below the candles, so they will be visible even if the values are too big or too small to be seen on the chart.
            • You are still not sure about some value? Use "Comment on chart" to print it on the upper left cornet. Multiple values can be printed.
            • Still not sure about some value? Use "Custom MQL4 code" block with code like:
            Print("My Variable Value Is: " + variable_name);
            

            This was the Print() function, but the Alert() can be used as well. They are described here:
            http://docs.mql4.com/common/print
            http://docs.mql4.com/common/alert

            • Make initial tests using lower timeframes and stops, to make everything faster
            • When you have groups of blocks, make sure that block IDs are ok. Lower numbers are executed first, so the group where the first block has lower number - it will execute before the group with greather number
            • There is some difference between backtest and live trading. On live you have previously closed trades and orders, while in the backtest there is nothing in the history. On live there is a delay when creating a new trade/order, and sometimes they are created on a different price (slippage). Also, sometimes errors happen on live, so...
            • ... always look at the logs for eventual problems
            1 Reply Last reply Reply Quote 0
            • fxDreema
              fxDreema last edited by

              The problem of the last project is that "grid_space_factor" is calculated only when there are no trades, and this is global variable for the EA which goes away when the EA is restarted. If you add the EA when there is Buy and Sell trade, the variable does not have a chance to be modified. Possible solution -> "Counter: Pass once"

              1 Reply Last reply Reply Quote 0
              • R
                ramsay09 last edited by

                Thanks for instructions to solve problems with EA but many of them are not relevant for Grid EAs. But I will try to applying them.

                I don't want you to verify strategy but to verify in case you have changed "once per order/trade" block if grid/"For each trade"-loop is working again. usually it takes up to 15 min. Just take EUR/USD -> set "grid denominator" value to 140 (approx. 5 pips grid space). If EA is adding another order after approx. 5 pips you have verified that EAs grid is working correctly otherwiese there is still something wrong.

                I don't think the variable is the problem because this is also not working:
                https://fxdreema.com/shared/TTE4TGiMc -> "grid_space_factor" is always up to date.
                The problem is not a restart but the loop "For each trade" and "pips away..." at all. I did not understand how to use the counter block to fix problem.

                Logically everything seem ok. I don't see any problem in this very simple EA. It should buy and sell every few pips what is the core-funktion of my EA. Support is in need.

                1 Reply Last reply Reply Quote 0
                • fxDreema
                  fxDreema last edited by

                  I added this EA, I used only 5 candles to calculate "support" and "resistance", so at the end the value of "grid_space_factor" was something like 5 pips... and I got bunch of trades close to each other with about 5 pips. So it probably works.

                  I fixed "once per order/trade" before, because you had another kind of problems with it. I added a simple check in it - to work only with trades created after the EA was added to the chart and skip all the trades and order that are older than that. So if you add the EA when you already have trades - the block will not work and will start to work when these trades are being closed and new ones are created. At least this is the idea.

                  1 Reply Last reply Reply Quote 0
                  • R
                    ramsay09 last edited by

                    I will verify that when markets are open again. Thanks.

                    But isn't it possible EA is recognizing his owen trades (magic number, market) and only if there are no trades, EA is opening new trades. Otherwise EA will keep on controlling trades and its loop will keep on running grid? please, make sure EA (loop) is running after mt4s, computers restart and even only EAs restart. The reson is after a while EA is running, he will have manny trades opened in market and against market. Some trades will be in profit some in loss and waiting to come in profit.

                    For this kind of EA it is very bad he is loosing control/track of his trades. EA always have to keep an eye on his babies and I have to keep an eye on EA :).

                    1 Reply Last reply Reply Quote 0
                    • fxDreema
                      fxDreema last edited by

                      That is true, but sometimes depends. Sometimes is better for the EA to forget some things when it is restarted. And sometimes not 🙂 But I don't use some fancy methods to save the current state of any EA when it is closed, all the EAs generated with fxDreema are very normal 1-file-only EAs, where no external files are used and no external files are written.

                      I am thinking sometimes - can I do something, so blocks like "Once a day" which normally have temporary memory, to store that memory also in external file, so in case the EA is reloaded - to continue from the same point. But there can be problems with that. What if you don't want and don't expect that? What if you remove the EA and add it again with different input parametes (different behaviour of the EA) - if you have "Once a day" block or something similar that will load some state from external file when the EA is loaded, this will probably make the EA to behave differently than expected. Not to mention if variables are saved and restored...

                      So it's always better to make the EA in a way to continue from where is it, or start again if that is needed. I prefer to use the trades itself as a memory - their open prices, stops, lot sizes are keeping some information and it can be used.

                      Otherwise I can't understand you in the last few posts - is it working or not... let's say that I don't understand your english very well. And I am also not native english, so... 🙂

                      1 Reply Last reply Reply Quote 0
                      • R
                        ramsay09 last edited by

                        Yes, my english could be better. Sometimes I am tending to press to much information into one sentence.

                        EA is still not working. What broker do you have? On FXCM EA seems not to work since reinstallation. What I mean that EA is not working is this behaviour: starting EA -> one buy and sell trade is placed -> market is moving beyond grid space but there are no thurther trades as expected. I have tried the "grid trading very basic" EA (replaced "ones per trade/order" before).

                        On backtest everything is working. What is the problem on live demo. I have changed my demo broker for verification. But it seems EA is opening ramdomly positions and there are no thurther orders placed after market has moved. I don't know what to do ):.

                        https://fxdreema.com/shared/3jLy74Bbc

                        1 Reply Last reply Reply Quote 0
                        • fxDreema
                          fxDreema last edited by

                          I have few simple questions:

                          • Are you aware of the value of the "grid_space_factor" variable after you add the EA to the chart?
                          • Do you understand what I mean by saying that I recently I updated the "once per trade/order" block in such a way, so now it can only work on trades/orders created after the EA was started? So if the trades were created before the EA was started - the block will not react.
                          • Do you want me to revert that update, so "once per trade/order" will start clear every time you start the EA?
                          1 Reply Last reply Reply Quote 0
                          • fxDreema
                            fxDreema last edited by

                            (before this, I posted another answer that is now on the previous page)

                            I intentionaly set "grid_space_factor" to 2 to make things faster, and after I added the EA I got this: http://prntscr.com/4rgdjd
                            Two initial trades were opened, and after a while - 2 more appeared.

                            Then I reloaded the EA and as expected, nothing more happens, because "once per trade/order" does not react for these previously opened trades. It will start to react if I close them all and everything starts again.

                            Let's say I revert that update or I add an option in "once per trade/order" to select how to react on old trades. If you decide to make it clear every time the EA starts, then it will be possible to create bunch of new trades every time you load the EA, maybe more than 2 at a time.

                            What you really need is "once per trade/order" to keep it's memory when the EA is removed and then, after the EA is loaded again - to load that memory and continue working. This is a little bit different than the way I updated it - by checking the trade's age and reject it if it was opened before the EA was started. But in the same time this also can create problems sometimes... it depends.

                            1 Reply Last reply Reply Quote 0
                            • R
                              ramsay09 last edited by

                              I will answere to you postings later (no time at the moment) but look to EA I have attached. I would like to have that behaviour (actually this is necessary).

                              ......
                              Grid-Super Money Grid.mq4

                              1 Reply Last reply Reply Quote 0
                              • fxDreema
                                fxDreema last edited by

                                Very well written ЕА 🙂

                                It seems to wait for the profit of the last trade to reach some value and then in creates a new trade. I probably missed the fact that you want to look in the last trade only to create a new one, which then turns into new last trade. In this case you actually don't need that "once per trade" block. When you look only at the last trade (let's call it trade A) and when you reach some profit for it, then a new one is created (trade B) with 0 profit (well, negative). The profit changes immediately. You will never go back to trade A again! So you don't need "once per trade", this happens naturally in the moment you create a new trade.

                                If for some other reason you are always looking at all available trades, then you will probably need this artifical "once per trade" functionality, but this is not your case.

                                1 Reply Last reply Reply Quote 0
                                • R
                                  ramsay09 last edited by

                                  regarding to your last posts, the "grid_space_factor" variable should and is always present and up to date when EA is running. If EA is restarted a new calculation will start immediately. Options are always good, they offer the oportunity to adapt something to someone needs. Make the changings optionally then everyone can choose what works best in his strategy and EA.

                                  But we have your last posting. I like this EA and this kind of trading. But there is potential to make it better. That is why I am here :). I try to create a better one. A company I was contacting got the permition from the owner of this free EA to recode EA. But recoding EA by someone else is to expensive for me.

                                  I can follow you what you have written but I don't know how to appy that to my EA. "Super Money Grid" is working, as you call it, in chart modell mode. My EA is using different modes e. g. double sided modell. What about "pips away...". As I have understand you, it is sufficient to create trades in a grid with the following condition:
                                  If ( "pips away..." > X) AND (last trades profit < 0) == buy now. But what about "double sided".

                                  What should I change and what blocks are to use to make EA is running with all modes in a manner "Super Money Grid" is doing?

                                  https://fxdreema.com/shared/2OASwIbWd

                                  1 Reply Last reply Reply Quote 0
                                  • fxDreema
                                    fxDreema last edited by

                                    Just remove those "once per trade/order" blocks and try it. I will suggest to connect block 54 to "Once per bar", so the variables will be calibrated on every new candle.

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      ramsay09 last edited by

                                      Thanks, grid is working again. Whan I am using same magic number again, EA is adding one lot in addition and on mt4's restart while EA is working and trades are open, EA is also adding one lot each but there is no random behaviour. Ok, it is not perfect but I can live with that for now. Later I have to find a solution for that.

                                      One another thing: your new "Draw Arrow" blocks are drawing lines/objects when "redraw the current object" is "yes" on backtests. The chart is full with lines until I rurn these blocks off. Could you find a solution, please.

                                      1 Reply Last reply Reply Quote 0
                                      • fxDreema
                                        fxDreema last edited by

                                        What, Draw Arrow creates lines? 😮

                                        The top two options control the number of objects to be created. There are 4 situations:

                                        • the block creates a new object every time
                                        • the block creates a new object once per bar
                                        • the block creates a new object once per bar, and then it updates it until the end of that bar
                                        • the block creates 1 object only, and then keeps it updated (this is what redraw means here)

                                        Again, this is what I already said few times, you can test any block or small group of blocks in a temporary separate project, to see how it behave.

                                        1 Reply Last reply Reply Quote 0
                                        • R
                                          ramsay09 last edited by

                                          I need a support and a resistence line. I have chosen both options "yes" on live demo it is working fine but on backtest I have to turn these blocks off otherwise I get a white screen (the lines). Backtest EA then you will see what I mean.

                                          https://fxdreema.com/shared/9UaI1dJVc

                                          By the way: the line are moveable but is it possible to write the new value (after moved) to back to EA so EA is working with the new value. Are there blocks or any solution.

                                          p.s.
                                          OK I got it. The first option have to be No.

                                          1 Reply Last reply Reply Quote 0
                                          • fxDreema
                                            fxDreema last edited by

                                            Yes, when the first option is No and the second is Yes, the block is allowed to create many objects (first option), but because it is set to redraw (second option) the current object, the result is that it creates 1 object and then it only redraws it.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 22
                                            • 23
                                            • 5 / 23
                                            • First post
                                              Last post

                                            Online Users

                                            C
                                            S
                                            S
                                            S
                                            A

                                            20
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors