fxDreema

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

    The strategy from scratch questions and problems

    Questions & Answers
    4
    62
    31700
    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.
    • C
      casebefx last edited by

      Is it possible to close trades by amount of money?.
      For example I have 100 usd gain and I want to close 50 usd giving order on usd not pips or percent.

      1 Reply Last reply Reply Quote 0
      • C
        casebefx last edited by

        Hello !

        I'm starting to build a strategy. Some problems have been solved in this topic.
        https://fxdreema.com/forum/viewtopic.php?f=2&t=2452

        However, I have another question:

        I want to open new trade on New Bar , not on new Tick. How can I do this?
        When conditions are met I want to open trade on new Bar (at the beginning of a new bar). Not "Once per bar".
        Part of my strategy must work onTick and the other part be performed on each new Bar.

        I created an example of a strategy where I put the code MQL4 with a different strategy.
        https://fxdreema.com/shared/jH5DPZsVd
        But it does not work.

        Can I get an example of how to do it. Or improve the MQL code in my strategy? Maybe some other way?

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

          Custom MQL4 code executes the code but it does not care of it, it passes every time.

          Once per bar contains similar code to what you are using there. It depends on where it is placed. On top level - it passes on the first tick that belongs to a new bar. Under some condition - it passes on the first tick where the condition becomes true, and if not already passes for that bar.

          What drives the EA are ticks. In real-time you can create some infinite loop and check the current server time each second, but in backtesting if you do that the EA will stuck. Here is some example to check this: https://fxdreema.com/shared/DyKSy5S2c

          So in short, in real-time we can detect the exact time where a new bar is created, but not in backtest. So Once per bar placed under the tick event works the same for both situations and it's pretty much accurate.

          1 Reply Last reply Reply Quote 0
          • C
            casebefx last edited by

            I have an example of the strategy.

            https://fxdreema.com/shared/7fxXqMded

            I would like to set TP for all open positions on the level where the profit of all open trades is 0 [zero] plus 3 pips. <for BUY>

            If is opened the first trade - nothing happens because there is a TP 3 Pips.
            If is opened a second trade - EA modify TP for first and second trade to level where profit for two trades is zero plus 3 pips.
            It will be the same level of TP for the first and second trades. If there are more trades BUY EA should modify TP for all open trades on the level where profit is 0 plus 3 pips.

            Conversely to sell - profit 0 minus 3 pips.

            How to do this ? Could you give an example ?

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

              For all trades as a group or for all trades - individually? Because there is Break even to do that for each one individually. As a group... it depends here, especially when you mix trade types, lot sizes, markets, pips, money and who knows what else. One easy way is to monitor equity-balance and close them all

              1 Reply Last reply Reply Quote 0
              • C
                casebefx last edited by

                For all open trades as a group.
                I have one trade 0.1 - no action becouse it has TP 3 pips.
                I have second trade 0.2 ( 10 pips lower than first trade ) - at this point I want to modify the TP for the first and second trade [first and second trade from Group 0 "empty" and specified market and all trades types BUY ]. I want to modify the TP to the point where the profit from the first and the second will be 0 plus 3 pips.
                Whenwill open the third trade, my EA modify trade first ,second, third to level where profit from this trades is 0 plus 3 pips.
                Similary with next trades...

                I know that I can close this differently, but a greater number of trades it takes longer than closing on TP.
                BE is for SL but I want modify TP.

                Is it some way for my problem ?

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

                  There is no block like this, and I'm not sure how can you easily make it with pink blocks without using too many of them. The best will be as a custom code (which I will be unable to create because I'm going out this holiday).
                  This sounds to me: set TP for group of trades as the equivalent of X pips for Y lots in market Z. And it will be something complex as a block, because multiple factors must be considered - trade types, lots, markets....
                  Otherwise if the market is like EURUSD where the value of 1 pip is fixed, it should be easier 😕

                  1 Reply Last reply Reply Quote 0
                  • C
                    casebefx last edited by

                    ok. I will try do it in other way.
                    If it will be wrong
                    I will wait for you after your holiday

                    1 Reply Last reply Reply Quote 0
                    • C
                      casebefx last edited by

                      ok. I will try do it in other way.
                      If it will be wrong
                      I will wait for you after your holiday

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

                        I added block "Trailing profit (group of trades)", and it have "money" option for trailing profit. There is also an option to recalculate (or not) take profits when there is new trade in the group.

                        I think this block will work for you if you place it after Buy now or Sell now, so it will be executed only once when a new trade is created (you don't need to trail all the time).

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

                          Now I decided to add option in Trailing stop blocks to make them reverse, instead of adding brand new blocks that are basically the same with few "-" signs here and there. But I will leave this block for now if you want to try it, and later I will probably remove it.

                          1 Reply Last reply Reply Quote 0
                          • C
                            casebefx last edited by

                            I have such a strategy.
                            https://fxdreema.com/shared/Bvb1Pd5Yc
                            and the indicator
                            http://prntscr.com/3uqhtn

                            I would like to trade when opened appears arrow up or down, regardless of the indicator.

                            Is it possible to do this program?

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

                              Arrows are objects, you can load objects and get some info from them, but this is not exactly a signal. Maybe some signal can be detected under "on Chart". Indicators should give their data and signals to the EA using their buffers. And when that is true, you can try those blocks in "Indicators" category. For example, "Indicator appear" is to be used with some biffer that represents arrow or line that is sometimes gone, sometimes present. Also "Condition" block, if it's something simple. And to be aware of what some indicator gives to the EA, use "Indicator tester" block to visually print data of one of it's buffers.

                              1 Reply Last reply Reply Quote 0
                              • C
                                casebefx last edited by

                                How can I check the volume of one opened (and existing trade ) ?

                                Could you give an example 🙂

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

                                  https://fxdreema.com/shared/jRwPB544
                                  This tells which trade(s) to work with: http://prntscr.com/3ysvmw In the case - only 1 trade, which is the very last one that is created.

                                  1 Reply Last reply Reply Quote 0
                                  • C
                                    casebefx last edited by

                                    Question again

                                    I have no trades.
                                    Than my EA opens trades but I have loss ( many losses transactions ) and account is loss.
                                    Later some trades are profit. And my profit ( on all account) is 200 % more than loss . Than EA closes all trades. I now I have no trades.
                                    EA starts again from begining.

                                    Is it possible that functions ?
                                    I have no idea how to do this.

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

                                      Collecting data, the maximum value of Balance-Equity, and then using that value to close all trades?

                                      1 Reply Last reply Reply Quote 0
                                      • C
                                        casebefx last edited by

                                        Return to questions and explanation with an example:

                                        From the time when there was no open trades loss is -100 $ in history. Now Open trade is + 200$. And it is 200% of the loss in the history of the moment when it was not open any trades. And now closes all positions.

                                        Or otherwise:
                                        If history is a loss of -100 $ from the moment when there was no open trades. And now is open trade and is $ 200 (profit is greater than the loss in the history of $ 100) - closes positions.

                                        Is it possible to generate by fxdreema ?

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

                                          It is possible to define and manage some variables, like what I have here: https://fxdreema.com/shared/pdqIetwpb
                                          Here I use the global account profit and that native MQL4 function AccountProfit() which gives us the current account profit.
                                          And this data is collected while the trade is running, which is what I thought you are asking for before.

                                          I don't really understand what "If history is a loss of -100 $" means, so...

                                          History trades... note that in live account you have many old history trades, let's say from months and even years ago. So the question is which history trades to work with, which one will be the oldest one. And what value you want to get from them - the average profit/loss, the total negative profit from all losable history trades (skipping the profitable ones) or something else...

                                          Or you want to get the difference between the starting Balance (when the EA was started) and the current Balance (or Equity)?

                                          1 Reply Last reply Reply Quote 0
                                          • C
                                            casebefx last edited by

                                            I have one Group 1 (for example)
                                            In this group I have opened trades
                                            first : BUY
                                            second :BUY
                                            third: BUY
                                            fourth: BUY
                                            fifth: BUY

                                            and now I want to set SL on third BUY for all trades. I do this by Trailing group, but how to determine that it is to be on the third trade or other trade ?
                                            Could you show example ?

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 1 / 4
                                            • First post
                                              Last post

                                            Online Users

                                            S
                                            G
                                            L
                                            K
                                            H

                                            15
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors