fxDreema

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

    Tutorial: Custom Martingale 1

    Tutorials by Users
    5
    5
    10257
    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.
    • M
      miro1360 last edited by

      important note: this is not about profitable EA, it is about custom martingale principle, do all tests only in tester or demo ...

      People are repeating question how to create martingale system.

      In this tutorial I will describe how to create simple, but less stable martingale. This is one method is ugly but is simple and is working in tester.
      Criteria:

      • separate buy and sell
      • buy trade is opened when fast MA crossed slow MA in up direction, opposite for sell
      • trade closed on fixed SL/TP
      • when trade is closed on SL, multiply volume for next trade by custom multiplier
      • perform lots reset when calculated lots value is more than some reset limit (skip reset when value is 0)
      • also reset lots on TP

      Lets start:
      Open new empty project:
      0_1528224435026_ef86ad99-e2fe-4c82-a7b6-b41b6c19ae2d-image.png

      Create few input parameters:
      0_1528224644447_e25d6dc6-b4ea-4f53-9ac9-6363cb69ece9-image.png

      Create few variables:
      0_1528224746621_3ce6d5a4-ada1-4d59-bab7-5f5cdc39f6ae-image.png

      In on Init section reset variables by lotsStart value:
      0_1528224945874_4650a257-7fc1-462a-99a9-07ef4658ad0f-image.png

      In on Tick section add few blocks based on condition, if there is no trade (separate for Buy/Sell) than open trade with variable lots:
      0_1528225163043_f66f48b0-aba9-4692-ab4b-149136d5c922-image.png

      Opposite for sell:
      0_1528225290064_e352d8da-2e9b-4e94-a6b1-408e917e667d-image.png

      Continue in on Trade section:
      Learn basic math and use custom code block in simpliest way for your math and add custom code ... for our example the logic criteria are:

      • when trade is closed on SL, multiply volume for next trade by custom multiplier
      • perform lots reset when calculated lots value is more than some reset limit (skip reset when value is 0)
        0_1528226020037_6d225e3a-3dcd-4d3f-95e3-a8410edb8183-image.png

      Do few changes for sell:
      0_1528226204381_db140127-1c30-44f2-99f3-f58e9cf23226-image.png

      And rest of blocks for TP reset:
      0_1528226331894_95519a0a-5508-4794-86ea-57e3db7648f6-image.png

      Run your EA in tester and you can see, that buy and sell are mixed and hard to find if martingale is working:
      0_1528229814538_946b9895-61b0-4dba-abdd-e961ef8922dd-image.png

      Think about input parameter for selecting trade type (only buy, only sell, or both), name this parameter tradeType and value 1 can be buy, value 2 can be sell, and 0 will representing both ... and add condition blocks into your logic:
      0_1528227355261_f09a3c77-a179-471b-b247-8961a887fc25-image.png

      Now test it. In EA settings (in metatrader tester) set tradeType = 1 (for only Buy trades) :
      0_1528227527970_fdf33295-fb7b-4362-8788-a9a6fdcc01ab-image.png

      Results are now much better to read:
      0_1528228987904_f8ef1fa6-8054-45db-b7d0-1d67850488fd-image.png

      Graph shows that we should consider to lower lotsReset value,
      0_1528229056684_a47ff8b6-10dc-42cb-ac05-f8301c75fb4f-image.png

      try lotsReset 0.17 .... see, slightly better, but still in loss, just martingale 😄
      0_1528229296244_e699ee01-8944-4831-9b6c-9c023c65c904-image.png

      try combined with sell, .... not much changed 😄
      0_1528229417474_deefae91-86bd-4fa6-9b35-6e2dc4aa9433-image.png

      anyway, this was not about profitable EA but about simple custom martingale ...

      shared link:
      https://fxdreema.com/shared/29RWlV12d

      Between trading and gambling is a very small gap, be careful.

      A 1 Reply Last reply Reply Quote 2
      • E
        Eray Dursun last edited by

        @miro1360 nice share,thanks............

        1 Reply Last reply Reply Quote 0
        • S
          swymov last edited by

          nice this i will use this

          1 Reply Last reply Reply Quote 0
          • A
            ambrogio @miro1360 last edited by

            @miro1360 thanks miro

            1 Reply Last reply Reply Quote 0
            • L
              Leopard234 last edited by

              Thanks miro, this tutorial I am looking for

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

              Online Users

              N
              S
              T
              A
              Y

              14
              Online

              146.7k
              Users

              22.4k
              Topics

              122.6k
              Posts

              Powered by NodeBB Forums | Contributors