fxDreema

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

    MAE maximum adverse excursion

    Questions & Answers
    3
    18
    3788
    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.
    • J
      jivetrader last edited by

      i could use a tip on how to find the maximum equity loss, or furthest adverse price value from the open, while a trade is open and export to a CSV file. hints appreciated.

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

        Ummmm... I'm not sure that I fully understand the question, but there is a block named "File write (Excel table)" over there where you can put up to 10 values to log.

        1 Reply Last reply Reply Quote 0
        • J
          jivetrader last edited by

          yes that part i see.

          MAE is how far the trade moved against you while it was open. so the challenge is, how to find the furthest that price moves against my position, while the trade was in place ? ie the maximum stop loss needed for the trade? any ideas appreciated.

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

            This is not implemented in MQL, also not in fxDreema. It sounds to me like some form of indicator or statistics, which is not so hard to cod, but it probably requires arrays, and I think arrays are too much for the people using EA builder.
            Maybe there are indicators like this somewhere?

            1 Reply Last reply Reply Quote 0
            • V
              varso last edited by

              maybe somethink like this
              https://fxdreema.com/shared/opYB93bSd
              but check it.

              1 Reply Last reply Reply Quote 0
              • J
                jivetrader last edited by

                for longs, i would like to find the the lowest price dropped during a trade (MAE)

                and the highest price reached during a trade (MFE)

                any help with this is appreciated thanks

                1 Reply Last reply Reply Quote 0
                • J
                  jivetrader last edited by

                  maybe something like this: if trade is running > pips away from open price > compare to previous value? if higher, store in a variable > at trade close, write variable to an excel file.

                  i just need help with the question mark part 🙂

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

                    __maybe something like this: if trade is running > pips away from open price > compare to previous value? if higher, store in a variable > at trade close, write variable to an excel file.

                    i just need help with the question mark part :)[/quote:1ml9vzke]
                    I think this is ok. Otherwise this information is not collected, let's say it's too specific, but it can be done anyway with some variable or with a custom block (if you know MQL4 of course).

                    1 Reply Last reply Reply Quote 0
                    • J
                      jivetrader last edited by

                      could you explain the Pips away from open module in detail please.

                      the help says: "Use this block to check how far from the open-price (of the currently loaded trade/order) the current market price is. It works with trades or orders."

                      Direction mode: Trading model, double-sided, or chart model - please explain. these options do not seem to affect the block parameters
                      Pips Away mode: fixed value, % of SL, % of TP, dynamic (pips)

                      once a bar, i want to compare the Pips from Open from the last time it was compared to the open. if it is greater, update the variable. if not, ignore it.

                      how do i store the current Pips away value, compare it, and update the value if necesssary?
                      thanks

                      1 Reply Last reply Reply Quote 0
                      • J
                        jivetrader last edited by

                        ok, i just found the Modify Variables block.

                        so i just need to know how to configure the Pips Away block. what is the 'Pips away' field- is this where you store the value into a variable? the Help is a little cryptic

                        thank you

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

                          Also variables can be modified at another place, click on this tab: http://prntscr.com/3y4g0m

                          1 Reply Last reply Reply Quote 0
                          • J
                            jivetrader last edited by

                            let's take MFE maximum favorable excursion - the max number of pips price has moved IN FAVOR of the trade, during the trade, ie. the most $ you could have made with supernatural timing - for LONG trades:

                            i can see a couple of ways to do this now, neither involves the Pips from Open block, which only passes if the trade is a specified number of pips from the open price of the trade. since we are trying to find the number of pips we are from this open we can either:

                            1. compare the current bid to the trade's open price in a loop until trade is closed
                            2. at close of trade, find the highest high since a specified bar or since a specified time (Formula block>Market Properties). [but how to identify the exact entry time is beyond me at this point]

                            i don't know how to post the code but this is working:

                            define project variables
                            MFE=0
                            MFEtemp=0

                            5 steps in sequence:

                            1. IF TRADE IS RUNNING, type: Buys
                            2. if bid > Trade/Order in Loop, Open Price (level) then (CONDITION)
                            3. MFEtemp = Bid - Trade/Order in Loop, Open Price (level) (FUNCTION)
                            4. if MFEtemp > MFE then (CONDITION)
                            5. MFE = MFEtemp (MODIFY VARIABLES)

                            MFE result is shown as a price level and needs conversion to pips. e.g. .0031 for 31 pips on a USD pair

                            variables will reset upon next trade entry and start again. so upon close of trade, i want to store this value to an .xls

                            also if anyone knows how to convert from price format to #pips for both Western and JPY pairs, i'd love to know
                            cheers

                            1 Reply Last reply Reply Quote 0
                            • J
                              jivetrader last edited by

                              could you post a link to a page that explains how that slide-out Variables box works? i still don't get it.

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

                                Look at the border colors. White border - there the variable is midified when entering the block. Orange border - when going to the orange output, Yellow - the yellow output, Gray - similar here.
                                In the field you need, write the value you want the variable to have. For example "2". Or "2+2". Or something more complex.
                                There are short names that each variable (and constant) gets for this block. V1, V2, V3... C1, C2, C3.... these can be used instead of their real names.

                                1 Reply Last reply Reply Quote 0
                                • J
                                  jivetrader last edited by

                                  thanks, i am using the slide-out variables now. this eliminates an extra Modify Variables block for me.

                                  can you help with the conversion from price format to #pips e.g. .0031 to 31pips, so that it works for regular and JPY pairs?

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

                                    If *10000 works, use this. But I don't like such a way to do things. In many places, for example Stop Loss in Buy now can be placed as a custom value - custom price level, custom pips or custom price fraction (price fraction is value like this 0.0031).

                                    Otherwise in the EA itself I use some function for these conversions, but I will not recommend someone to use them 🙂 Sometimes I change them or rename them. But you can always use native functions.

                                    1 Reply Last reply Reply Quote 0
                                    • J
                                      jivetrader last edited by

                                      how can i search the current pair name if it contains "JPY" and if found, use 100. if not use 10000. ?

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

                                        http://docs.mql4.com/strings/stringfind
                                        What do you want to do?

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

                                        Online Users

                                        B
                                        A
                                        T
                                        M
                                        E
                                        C

                                        19
                                        Online

                                        146.7k
                                        Users

                                        22.4k
                                        Topics

                                        122.6k
                                        Posts

                                        Powered by NodeBB Forums | Contributors