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!
See more
See less

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


          #5
          Originally posted by NinjaTrader_BrandonH View Post
          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.
          Are MaeTicks and MfeTicks only used in System Performance Real Time Trades? Or can they be used on a chart on historical trades too using System performance All Trades?
          Thanks.

          Comment


            #6
            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 PaulMohn, Today, 05:00 AM
            0 responses
            5 views
            0 likes
            Last Post PaulMohn  
            Started by ZenCortexAuCost, Today, 04:24 AM
            0 responses
            5 views
            0 likes
            Last Post ZenCortexAuCost  
            Started by ZenCortexAuCost, Today, 04:22 AM
            0 responses
            2 views
            0 likes
            Last Post ZenCortexAuCost  
            Started by SantoshXX, Today, 03:09 AM
            0 responses
            15 views
            0 likes
            Last Post SantoshXX  
            Started by DanielTynera, Today, 01:14 AM
            0 responses
            3 views
            0 likes
            Last Post DanielTynera  
            Working...
            X