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.
MAE maximum adverse excursion
-
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.
-
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.
-
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.
-
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? -
maybe somethink like this
https://fxdreema.com/shared/opYB93bSd
but check it. - 2 months later
-
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
-
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
-
__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). -
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 -
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
-
Also variables can be modified at another place, click on this tab: http://prntscr.com/3y4g0m
-
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:
- compare the current bid to the trade's open price in a loop until trade is closed
- 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=05 steps in sequence:
- IF TRADE IS RUNNING, type: Buys
- if bid > Trade/Order in Loop, Open Price (level) then (CONDITION)
- MFEtemp = Bid - Trade/Order in Loop, Open Price (level) (FUNCTION)
- if MFEtemp > MFE then (CONDITION)
- 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 -
could you post a link to a page that explains how that slide-out Variables box works? i still don't get it.
-
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. -
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?
-
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.
-
how can i search the current pair name if it contains "JPY" and if found, use 100. if not use 10000. ?
-
http://docs.mql4.com/strings/stringfind
What do you want to do?