Can't get MAEAsOfBarPercent() to work...
Author: kfmfe04
Creation Date: 2/24/2009 6:59 AM
profile picture

kfmfe04

#1
I copied and pasted this code from Help/Example (with slight modification to show MAE when closing) but all I get are NaN's for MAEAsOfBarPercent():

Is it broken or is the code wrong?

CODE:
Please log in to see this code.


profile picture

Eugene

#2
Since I can't reproduce the issue, it could have something to do with your data:
How to report a Problem?
profile picture

kfmfe04

#3
WL 5.1.5.10
Vista 32-bit 2GB RAM

The code is above. The odd thing is, "MAE %" (one column over) is fine.



profile picture

kfmfe04

#4

Need clarification: is it true that MAE and MAEPercent CANNOT be used in the Simulator, but it's okay to use MAEAsOfBar() and MAEAsOfBarPercent()?

All I'm looking to get working are MAEAsOfBar() and MAEAsOfBarPercent() in Simulator.

My data comes from the standard Yahoo download - I get the NaN error no matter which stock I pick or if I pick the entire index like Dow 30.

- Ken

----------------------------------------------------

QUOTE:
MAE Property
double MAE

Returns the Maximum Adverse Excursion (MAE) that was generated by the Position, with commissions applied. MAE represents the largest intraday loss that the trade experienced during its lifetime. This property is intended for use by Performance Visualizers, and not in Strategies.

Remarks
MAE is not available during Strategy execution, and is only available to Performance Visualizers that execute after position sizing has been applied.

profile picture

Eugene

#5
I'm taking a look in your Double.NaN problem...

The data doesn't seem to play a part here. What are your Windows regional settings? Any modification to the default preset?

QUOTE:
All I'm looking to get working are MAEAsOfBar() and MAEAsOfBarPercent() in Simulator.


Meanwhile WL5 does not have Simulator so your question sounds ambiguously. The documentation says just what it says: although the MAE/MFE properties of the Position object aren't available, there's a host of other properties designed to be used when Strategy executes - namely MAEAsOfBar/MAEAsOfBarPercent and MFEAsOfBar/MFEAsOfBarPercent.
profile picture

Eugene

#6
I can reproduce the "MAE is NaN" in only one very specific case:

1) Using the MAE property in Strategy code (which isn't designed for usage in strategies, only in Performance Visualizers)
CODE:
Please log in to see this code.

2) Changing it to MAEAsOfBarPercent
3) and not recompiling the code.

Try to recompile the Strategy before executing.