Go Back   NinjaTrader Support Forum > Application Technical Support > Strategy Analyzer

Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer.

Reply
 
Thread Tools Display Modes
Old 04-26-2011, 04:54 AM   #1
shiva_mohan
Junior Member
 
Join Date: Nov 2010
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
Default Understanding MAE

Hi,

I don't think I'm properly understanding MAE. Could you please shed some light to this scenario:

I have a stop loss that is 2 points away from my entry. My stop gets hit so the profit on the trade is -2 points. However, the MAE on the trade is recorded as 4 points?

Should the MAE not be 2 points?

Here is the image of the trade in question. The rectangle highlights the long entered at 1329 and stopped out at 1327.



Cheers
Attached Images
File Type: jpg ES 03-11 (3 RangeNoGap) 15_02_2011.jpg (96.7 KB, 31 views)
Last edited by shiva_mohan; 04-26-2011 at 04:57 AM.
shiva_mohan is offline  
Reply With Quote
Old 04-26-2011, 05:33 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 25,630
Thanks: 427
Thanked 1,646 times in 1,608 posts
Default

Hi shiva_mohan, please see those definitions here - http://www.ninjatrader.com/support/h...efinitions.htm

It would take the worst price traded - which is the low of the bar in your case, not the stop value - so the MAE is higher than your loss here.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 04-26-2011, 05:36 AM   #3
shiva_mohan
Junior Member
 
Join Date: Nov 2010
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Bertrand,

Yup I already read that ... it is based on my understanding of that documentation ...

Quote:
MAE (max. adverse excursion) is defined as |worst price trade reached)
that from my example, MAE in my mind should be 2.0 but actually is 4.0.

That is why I wanted to clarify my understanding with the example posted.

Thanks
shiva_mohan is offline  
Reply With Quote
Old 02-08-2012, 09:06 AM   #4
everington_f
Member
 
Join Date: Nov 2008
Posts: 78
Thanks: 9
Thanked 0 times in 0 posts
Default Simple MAE Print to output

What code can you add to simply print the highest price reached by the market during the time that a short trade was open? Help apprciated.


if (Position.MarketPosition == MarketPosition.Flat
&& PriorDayOHLC().PriorOpen[
0] < PriorDayOHLC().PriorClose[0]
&& (CurrentDayOHL().CurrentOpen[0] - PriorDayOHLC().PriorClose[0]) > 1.5
&& CurrentDayOHL().CurrentOpen[0] > PriorDayOHLC().PriorClose[0]
&& CurrentDayOHL().CurrentOpen[
0] <= PriorDayOHLC().PriorHigh[0] && Bars.FirstBarOfSession)

{
EnterShort(DefaultQuantity,
"U Short");
}
 

{
SetStopLoss(
"U Short", CalculationMode.Ticks, CurrentDayOHLC().CurrentOpen[0]+25) , false);
SetProfitTarget (
"U Short", CalculationMode.Ticks,((PriorDayOHLC().PriorClose[0]) - 25));
}
everington_f is offline  
Reply With Quote
Old 02-08-2012, 12:33 PM   #5
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 553 times in 545 posts
Default

Hello everington_f,
Thanks for your post.

To get the Higest price since entry please use this code:
Code:
Print(MAX(High, BarsSinceEntry() + 1)[0]);
Please let me know if I can assit you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 02-09-2012, 02:42 AM   #6
everington_f
Member
 
Join Date: Nov 2008
Posts: 78
Thanks: 9
Thanked 0 times in 0 posts
Default

Ok I get multiple lines in the output window for each day.... there should be only one output value per day, as this strategy trades once every session. Should this code be inserted after OnExecution?

Regards and thx
everington_f is offline  
Reply With Quote
Old 02-09-2012, 08:55 AM   #7
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 553 times in 545 posts
Default

Hello everington_f,
Its difficult to say for sure unless I know what exactly you are trying to do.
If you have put the code in OnExecution and getting multiple prints then most probably the orders are part-filled. In such scenario please filter the same by the following code:
Code:
protected override void OnExecution(IExecution execution)
{
	if (execution.Order.OrderState == OrderState.Filled)
{
		Print(MAX(High, BarsSinceEntry() + 1)[0]);
	}
	//do rest of the stuff
}
To assist you further please furnish a bit more details and either upload the code or send it to support[AT]ninjatrader[DOT]com if possible, giving the reference of this thread and Attn:Joydeep in the subject line.

I look forward to assist you further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding MASlopePlot cmspruill Indicator Development 1 03-26-2011 10:53 AM
Help understanding logic lookOutBelow General Programming 3 03-09-2011 02:43 PM
Help with SYMBOLS, am I understanding these..... mdsvtr Miscellaneous Support 7 12-02-2010 05:17 AM
Understanding BuySellPressure Crumbs Charting 1 01-28-2010 12:38 PM
Understanding Bars The Kid Strategy Development 4 11-18-2008 07:04 AM


All times are GMT -6. The time now is 05:30 PM.

FULL RISK DISCLOSURE: Futures trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.