How can I call MfeTicks (I found this in help guide), i.e. Maximum Favorable Excursion in ticks, but I don't see anywhere in help the exact command how it is called.
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Call MfeTicks
Collapse
X
-
Hello UltraNIX,
Thank you for your post.
MfeTicks is a property of the Trade object which may access information about trades from the collection named RealTimeTrades. You may call the MfeTicks property by first checking to ensure there is at least one trade in the RealTimeTrades collection followed by calling Trade.MfeTicks.
I have posted an example below demonstrating how this could be accomplished.
protected override void OnBarUpdate()
{
if (SystemPerformance.RealTimeTrades.Count > 0)
{
// Check to make sure there is at least one trade in the collection
Trade lastTrade = SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count - 1];
// Calculate the last Max Favorable Excursion in ticks
double lastMfeTicks = lastTrade.MfeTicks;
}
}
Please review this help guide link for more information about how Trade methods and properties could be used - https://ninjatrader.com/support/help...nt8/?trade.htm
Let us know if we may further assist.Brandon H.NinjaTrader Customer Service
-
So it cannot be used in backtest/optimization?
Then tell me the alternative (like logging highest high for longs and lowest low for shorts) that I could use in all modes, Optimization/Backtest included. I want to set up a conditional to exit trade if it moves X number of ticks against me from the best point in the trade.
Comment
-
Hello UltraNIX,
Thank you for your reply.
The TradeCollection SystemPerformance.AllTrades may be used instead of SystemPerformance.RealTimeTrades to get the MfeTicks value when backtesting or optimizing a strategy. Backtesting may done only using historical data. AllTrades could be used for backtesting/optimizations because it contains both historical and realtime trades whereas RealTimeTrades only contains trades that happen realtime.
Please see this help guide link about TradeCollections for more information - https://ninjatrader.com/support/help...collection.htm
Let us know if we may further assist.
Brandon H.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_BrandonH View PostHello UltraNIX,
Thank you for your post.
MfeTicks is a property of the Trade object which may access information about trades from the collection named RealTimeTrades. You may call the MfeTicks property by first checking to ensure there is at least one trade in the RealTimeTrades collection followed by calling Trade.MfeTicks.
I have posted an example below demonstrating how this could be accomplished.
protected override void OnBarUpdate()
{
if (SystemPerformance.RealTimeTrades.Count > 0)
{
// Check to make sure there is at least one trade in the collection
Trade lastTrade = SystemPerformance.RealTimeTrades[SystemPerformance.RealTimeTrades.Count - 1];
// Calculate the last Max Favorable Excursion in ticks
double lastMfeTicks = lastTrade.MfeTicks;
}
}
Please review this help guide link for more information about how Trade methods and properties could be used - https://ninjatrader.com/support/help...nt8/?trade.htm
Let us know if we may further assist.
Thanks.
Comment
-
Hello Trader17,
Thanks for your note.
MaeTicks and MfeTicks are properties of a Trade object. Trade objects could be in the SystemPerformance.RealTimeTrades collection or the SystemPerformance.AllTrades collection.
See this help guide for more information about SystemPerformance.AllTrades: https://ninjatrader.com/support/help.../alltrades.htm
Let us know if we may further assist.Brandon H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rocketman7, Today, 02:12 AM
|
0 responses
5 views
0 likes
|
Last Post
by rocketman7
Today, 02:12 AM
|
||
Started by dustydbayer, Today, 01:59 AM
|
0 responses
1 view
0 likes
|
Last Post
by dustydbayer
Today, 01:59 AM
|
||
Started by inanazsocial, Today, 01:15 AM
|
0 responses
4 views
0 likes
|
Last Post
by inanazsocial
Today, 01:15 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
22 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
Comment