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.
    • fxDreema
      fxDreema last edited by

      If "No trade is running" is on top (and Group numbers, trade type and market match), no trade will be created. This is as simple as this: https://fxdreema.com/demo/mt4-buy-now-i ... ade-exists

      What you have on that picture is what you say you got. On every tick this gets some information from the last closed trade and the opens new trade. Until you have newly closed trade, it will just put trades one after another.

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

        ahh i see. hmmm I will try to change my logic then or move the blocks around i guess. how do I work around it? any ideas?

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

          It really depends on what you want to do. You know that blocks are executed on every tick, so connect them in a way to get the result you want 🙂

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

            I shall make it work 😁

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

              ok so i moved the blocks around.. corrected my logic. seems to be working except that now it is opening both buy and sell at the same time. it should be opening only one trade because in the logic it should check the loser type if it's buy or sell and execute the next blocks accordingly.

              screenshot3.jpg

              ......
              screenshot3.jpg

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

                Damn, you are right, this block was faulty. I think I fixed it, how is it now?

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

                  I tested it and now it's 2 sells if last loser type was buy and 2 buys if last loser type was sell...even though i have once per trade in the logic. a bit weird. maybe the code might need looking at again. 😢

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

                    nvm it is working perfectly. I had my group no. wrong!!! 😄 thanks a lot!!

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

                      actually it's working fine if it's connected like this:

                      screenshot4.jpg

                      and it's putting two buys and sells when connected like this:

                      screenshot5.jpg

                      ......
                      screenshot4.jpg
                      screenshot5.jpg

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

                        By the way "once per trade/order" are not needed at all.

                        If I use MA as an indicator (for the other group of blocks you have) I have this: http://prntscr.com/3ez8qs And I think it looks normal. No double trades anywhere. If you have double trades on live, search if you have another EA running in the same time.

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

                          nop i am backtesting. and if i remove once per trade then it's putting buy/sell trades every tick. but with once per trade/order it's the same 2 buys when last loser type was sell and 2 sell when last loser type was buy. but when i don't use the yellow out at all which would be the opposite of the condition for check last loser type it is putting only one buy/sell trade as it should.

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

                            still testing. I might have to do one thing though. How can i have two numbers in the group condition?.. for example 1 and 2. separated by comma or what?

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

                              Not possible yet, but I don't think you need it. If you can separate trades by type (buys and sells) it will be better. There is something weird on your side, I don't know what. It can be because you are using those checkboxes for input parameters. I downloaded your project and tried it on my side... all looks normal. So if you have TeamViewer I can check what is going on there.

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

                                yea I made it work. i had to put two "no trades are running" with different group numbers. I knew the problem was with my group number because i have other buy/sell being executed by the price crossover indicator. well you already know coz you tested it out now. but anyways what's up with the group number. can it be changed so that we can have 2 different group numbers in the same condition. that would be helpful i think.

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

                                  oh btw the new price over indicator box is awesome. so helpful. thanks 😄

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

                                    I just had a question regarding something. How would I go about setting up a scenario like this. I would like to have 2 or three targets from open price. For example:

                                    a) Buy trade. Price moves 20 pips and then keeps on going to 40 but it doesn't reach 50 and starts to turn back and comes back to 20 pips. I want to close that trade at 20 pips.

                                    b) Buy trade. Price moves 20 pips and then keeps on going to 50 pips and then goes a bit further to 70 pips but starts to turn back and comes back to 50 pips. again close the trade at 50 pips.

                                    vice versa for sell trades.

                                    which blocks should i be looking for. I figured it would be 'pips away from open-price' but how can I have those targets. I want something that is calculating how much price has moved in pips and then remember those targets that i set to close the trades at. I hope this is achievable. Any help would be greatly appreciated.

                                    p.s i don't want to use trailing stops...

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

                                      This sounds to me the regular trailing stop with some custom step.
                                      Here is some example https://fxdreema.com/demo/mt4-trailing-stop
                                      And here it is again, but with more custom scenario https://fxdreema.com/demo/mt4-loop-trailing-stop

                                      Otherwise I have to create a block some day that will have X custom levels. For example to move the price with 10 pips when the profit is 20, then to 15 pips when the profit is 18... something like this. I don't know when will I make this, but it can be made with those pink blocks... if you get their idea 🙂

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

                                        can you explain step mode and step size a bit please? and also in the block 'pips away from open price' can you please explain the options in direction mode?

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

                                          that would be awesome 🙂 i can probably help in making those pink blocks. It is a good idea though 😛

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

                                            Well, the idea of these blocks is that you can control things in deeper lever, like in MQL4/MQL5. It's basically like this: For each trade -> do this (else do this) -> do this (else do this) -> do this (else do this).
                                            "For each Trade" is the block who knows how many trades there are (and some filters can be used inside). It loads the first one in the list and gives it to the next blocks... they do something with it. Then the next trade comes - the same thing happens to it (depending on what the next blocks are).

                                            But now I think you can use the "Break even" block, if you only have 1 modification step for SL. This block is used to lock SL at open price level (once) when there is some profit, but there are some options inside to select when to do that and at what level (Pips on profit and BEP offset mode).

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

                                            Online Users

                                            V
                                            E

                                            19
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors