fxDreema

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

    MathSrand problem

    Questions & Answers
    4
    36
    6201
    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.
    • AlphaOmega
      AlphaOmega last edited by

      @roar MathSrand(GetTickCount());

      Hi
      If someone could give me a hand please... I started a new thread because the other one was old and the old topic does not really address the problem I have.

      Is there any other code except MathSrand(GetTickCount()); I can use to rectify the expert because every first order it takes is not part of count of the total lots. Or maybe setup of expert blocks is wrong?
      This is my goal
      If the conditions is met but price action still moves further away from 1st trade(parent) in a negative direction: another order must be taken -30 pips(first child trade) away from original entry and then -30pips away from 1st child trade, etc..... and the lot sizes must be exponentially added on an averaging basis of a +/-150% of previous negative lot size, on every new child order. For example: 0.01(parent), 0.02(1st child), 0.03(2nd child) etc, and the take profit must modify 25% above the average of all trades

      My effort:
      https://fxdreema.com/shared/x5dk8lW9b

      Roar original code:
      https://fxdreema.com/shared/ucZlZvYcc

      Thank you in advance

      roar 1 Reply Last reply Reply Quote 0
      • roar
        roar @AlphaOmega last edited by

        @alphaomega this comparison gives trouble:
        0_1612738599702_a1810fb1-c1a6-48f3-afab-e1987f747dbf-image.png

        Just set it to "equal to 0" (or just use "no trade" block), then I think your grid will work.

        Also, you dont need MathSrand(GetTickCount()) code, that was just setting some random lot sizes in my test. You dont have random lot sizes here.

        Need small help? Tag me in your post
        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

        AlphaOmega 2 Replies Last reply Reply Quote 0
        • AlphaOmega
          AlphaOmega @roar last edited by

          @roar As always .. you are the best!!!! Thank you.

          1 Reply Last reply Reply Quote 0
          • AlphaOmega
            AlphaOmega @roar last edited by AlphaOmega

            @roar Sorry to bother again ... I have changed the parameters as you said ... I still do not know how to get the first order to take a TP or SL? The TP and SL only kicks in if the 2nd order is taken. Thanks in advance.
            https://fxdreema.com/shared/SScWMSFud
            0_1612809060913_5d281eda-c0fd-4e13-8242-2b7420a71ee7-image.png

            roar 1 Reply Last reply Reply Quote 0
            • roar
              roar @AlphaOmega last edited by

              @alphaomega the "position created" may still have some problems.. You dont have to use that block or "On Trade" tab at all. Just modify the stops after doing the orders:
              0_1612809505081_e34e596d-1143-4f0b-b161-bde778fac3fc-image.png

              Need small help? Tag me in your post
              Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

              AlphaOmega 2 Replies Last reply Reply Quote 0
              • AlphaOmega
                AlphaOmega @roar last edited by

                @roar Thanks for the reply..... Ok ... let me fight a bit with this and then will come back to you

                1 Reply Last reply Reply Quote 0
                • AlphaOmega
                  AlphaOmega @roar last edited by

                  @roar .. Hi Mr Roar I need your input again please. The expert does it,s averaging job very well but I do not understand where the TP comes from and where to set it? I have tried to control the TP with the adjustment add-on but it does not work correctly. Thank you in advance.

                  https://fxdreema.com/shared/qNM670Mtc

                  roar 1 Reply Last reply Reply Quote 0
                  • roar
                    roar @AlphaOmega last edited by roar

                    @alphaomega in your project, take profit is the average line.
                    Graphical objects are sometimes buggy, though, its better to simply insert the average variable directly into the TP field.

                    0_1614882949440_e271b116-5126-4737-8af3-be3ca79087aa-image.png

                    Need small help? Tag me in your post
                    Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                    AlphaOmega 2 Replies Last reply Reply Quote 0
                    • AlphaOmega
                      AlphaOmega @roar last edited by

                      @roar Thanks so much for your speedy reply... let me do that .. I will come back with results... Thank you!!

                      1 Reply Last reply Reply Quote 0
                      • AlphaOmega
                        AlphaOmega @roar last edited by AlphaOmega

                        @roar .. Hi Roar.. Sorry to bother you again... I have changed the settings as I understand you said and it is working but the TP is very small, like in cents..lol.. I must be doing something wrong again. Also, if I try change the settings there is no TP for the first order and the TP does not modify to the average if the 2nd order is placed, it just stays at the first order"s average. I have attached some pictures for you. Please advice me again. Thank you in advance

                        0_1614937436632_3fcae188-e750-4f63-b686-fc13192b6a1a-image.png
                        0_1614937484917_17a66b17-6483-4ebd-9c42-81369f410c79-image.png
                        0_1614937548709_c787475b-36b9-40cb-a3d3-38a62fca1e98-image.png
                        0_1614937588261_0cbdf246-1280-43b3-8e4b-ab745293006a-image.png

                        1 Reply Last reply Reply Quote 0
                        • B
                          biztet last edited by

                          Hi @AlphaOmega , how are you?
                          You can check your mt4 connected to cent acc or std acc. I've experience this before.
                          If cent acc, try login to any std acc. Then do your backtesting.

                          AlphaOmega 1 Reply Last reply Reply Quote 0
                          • AlphaOmega
                            AlphaOmega @biztet last edited by AlphaOmega

                            @biztet I am good! How are you my friend?... No I am running this on MT5 std account. The problem is definitely with the coding or the way I connected the blocks.. I am just to dumb to understand how to fix it. I do not think its a big problem. .. Mr Roar will sort it out I am dead sure!

                            roar 1 Reply Last reply Reply Quote 0
                            • roar
                              roar @AlphaOmega last edited by roar

                              @alphaomega where do you want the TP?
                              If TP is average open price of trades, it surely will be very small in pip terms.

                              Need small help? Tag me in your post
                              Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                              AlphaOmega 4 Replies Last reply Reply Quote 0
                              • AlphaOmega
                                AlphaOmega @roar last edited by AlphaOmega

                                @roar Hallo Roar... thanks for replying... I want at least 15% in profit from average of all open price of trades .. How do I control it? Thank you in advance for your reply

                                1 Reply Last reply Reply Quote 0
                                • AlphaOmega
                                  AlphaOmega @roar last edited by AlphaOmega

                                  @roar I have also tried this formula... but it also gives some error.. so I do not understand how to do it..
                                  0_1614952108222_7fabec5b-1461-4eb4-9396-1c173195aede-image.png

                                  1 Reply Last reply Reply Quote 0
                                  • AlphaOmega
                                    AlphaOmega @roar last edited by

                                    @roar This formula seems to work but it would not give me the TP
                                    0_1614959134708_02010f40-21dd-489b-a047-54197c833647-image.png

                                    1 Reply Last reply Reply Quote 0
                                    • AlphaOmega
                                      AlphaOmega @roar last edited by

                                      @roar Hallo Roar... when you have time please sort me out here... I am stuck. I want at least 15% in profit from average of all open price of trades .. How do I control it?
                                      Attached is my last effort. Thank you in advance for your reply
                                      https://fxdreema.com/shared/W3TcZf7he

                                      roar 1 Reply Last reply Reply Quote 0
                                      • roar
                                        roar @AlphaOmega last edited by roar

                                        @alphaomega what do you mean by 15%? It takes many years for a forex symbol to move 15%

                                        Or just equity > balance * 1.15 ? You dont need average for that.

                                        Need small help? Tag me in your post
                                        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                                        AlphaOmega 1 Reply Last reply Reply Quote 0
                                        • AlphaOmega
                                          AlphaOmega @roar last edited by

                                          @roar I will put it in a picture for better clarity because maybe I am expressing myself incorrectly. Please check the attached... Thanks in advance
                                          0_1615074987731_To Roar.PNG

                                          roar 1 Reply Last reply Reply Quote 0
                                          • roar
                                            roar @AlphaOmega last edited by roar

                                            @alphaomega I understand that you want to move the line, but where does that value come from? What calculation gives 15% as result? Perhaps 15% of the distance between highest and lowest trade?`

                                            If you mean 15% more profit in pips, that makes no sense: profit at the average line is 0, 0 times 15% is still 0. It doesnt move anywhere by a percentage multiplication.

                                            Need small help? Tag me in your post
                                            Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

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

                                            Online Users

                                            S
                                            D
                                            V
                                            O

                                            28
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors