Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Call MfeTicks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Call MfeTicks

    Hello,

    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.


    #2
    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

    Comment


      #3
      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


        #4
        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

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by TomTownsend, Yesterday, 10:12 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rdeste911, Today, 02:04 AM
        0 responses
        5 views
        0 likes
        Last Post rdeste911  
        Started by aligator, Yesterday, 04:32 PM
        1 response
        26 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by zacharydw00, Yesterday, 05:14 PM
        0 responses
        12 views
        0 likes
        Last Post zacharydw00  
        Started by shahabjet1, Yesterday, 04:47 PM
        0 responses
        24 views
        0 likes
        Last Post shahabjet1  
        Working...
        X