fxDreema

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

    Problem with check last closed trade profit code

    Questions & Answers
    2
    42
    11710
    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
      rocker699 last edited by

      Hi there,

      Getting code error for check last closed trade profit. I have attached a screen shot of mt4 (build 625).I was wondering if you could look into my project and see if I am doing anything wrong here?? please? Any help would be greatly appreciated 🙂

      mt4 screenshot.jpg

      ......
      mt4 screenshot.jpg

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

        I checked this block, it looks fine. What do you have in it's parameters, and are you sure the problems comes from it? The problem is that somewhere something is not closed, missing ) or } probably, which leads to multiple error messages.

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

          Sorry I should have explained myself better. I want to close a loser trade with 50pips or greater and put a opposite (buy/sell) of the closed trade. and put a trailing stop for only the trades that are stopped out at 50 or greater. can this be done? I tried to number the group of trades as 1 to specify but I might not understand group correctly.

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

            ofcourse the trailing stop is going to be for the opposite trade/order after the 50pip loss trade.

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

              I see code error here, this is not a logical error. Something is wrong in the output code, some ) or } (or other MQL4 part) is missing somewhere. Can you tell me which block causes this to happen? Also what if you use the same block, but as a new one (with all default parameters)?

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

                The block is 'check last closed trade profit'. I tried using a new block and it gives the same error.

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

                  Well, I tested it (build 080) and I have no problems with it. Can you upload .mq4 file here? It can contain only this block and some other, there is no need to be a whole strategy.

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

                    sure. here it is. no changes made.. nothing special about this ea anyways lol hopefully the problem can be resolved. thank you.

                    ......
                    nonlagma (91).mq4

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

                      It looks that this parameter http://prntscr.com/3e71yj is not ready to be used as an input parameter. Because it's not a value, it's a sign (< or > or == or something else) that is used directly in the code. Just uncheck it.

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

                        thank you very much. I will try it out. and also is there a way to group trades? For example Group#1 will have certain criteria and Group#2 will have certain criteria...like different trailing loss and stops depending on which group they belong to?

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

                          I choosed to group trades and orders using their magic number. There are no many options actually, the only parameters we can use for something like this are Magic Number and Comment, but the Comment should be available for the user so what remains is the Magic Number.

                          So yes, that Group number is connected in some way with the Magic Number and you can create trades with certain Group number and then use trailing stop set to trail only those trades with that Group number. Here is a little bit more about this topic, I hope you will understand it: https://fxdreema.com/documentation/proj ... d%20groups

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

                            ok so as i understand it... I will basically put a number in group# lets say 1 for buy/sell and then put the same number for different blocks with the same number for example the close trades group# will be 1 as well for that buy/sell trade. is that right?

                            screenshot1.jpg

                            ......
                            screenshot1.jpg

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

                              Yes

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

                                thankyou for all your hard work 🙂 and also I have seen that with some brokers the EA's do not work properly and on others they work perfectly fine. why is that?

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

                                  Well, by "Does not work properly" I understand that the problem can be everything. Define "Does not work properly"?

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

                                    Well for instance one of the EA's was working fine for me for Oanda and Tenkofx. Proper execution of the all the trades and whatever logic or strategy is working. but then the other day I downloaded Octafx mt4 and on that it was putting way too many sells and buys and not working according to the logic or strategy but it was completely fine for the other two brokers.

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

                                      I am guessing the problem here is not the EA itself but a problem with the broker platform.

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

                                        Too many buys and sells sounds to me like logic issue. If we take the EA from the picture above, it depends on what timeframe it is added, and the result will be as many trades as many bars are created. Well, if the timeframe parameter in "Once per bar" blocks are set to "Current".
                                        So, this EA creates new trades based on time. It does not care id there are some at the moment, it just works from time to time. This is not wrong normally, but if you don't want to do it that way and it is that way - then it's wrong.

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

                                          well no it's no for the EA above in the picture. That works completely fine on all brokers. It is when i try to put the blue blocks and then put buy and sell...those trades are executed every tick. Like so..

                                          screenshot2.jpg

                                          The logic is very simple. For example if the last closed trade was a buy with a loss of more than a certain pips amount then an opposite trade is executed. But when that trade is executed it is every tick. I tried to put the block 'No trade is running' and 'For each trade' but same result. even tried to put it on trade event still not working. But like i said...only for one broker it is behaving like this..for the other two it works fine.

                                          ......
                                          screenshot2.jpg

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

                                          Online Users

                                          C
                                          P
                                          E
                                          R
                                          F

                                          13
                                          Online

                                          146.7k
                                          Users

                                          22.4k
                                          Topics

                                          122.6k
                                          Posts

                                          Powered by NodeBB Forums | Contributors