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

Looking for a "countdown-like" or "distance-from" indicator

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

    Looking for a "countdown-like" or "distance-from" indicator

    I am looking for a "countdown-like" or "distance-from" indicator that will provide real-time, tick-by-tick distance of the current price from a Moving Average (more specifically, an EMA).

    For example, we have numerous types of countdown style tools for showing data such as amount of time remaining in a minute bar or the number of Ticks remaining in a Tick Bar, etc.

    Is anyone aware of the existence of such a "distance-from" tool either within this Community Forum (I did do a search that was not successful) or in outside Forums (such as BMT).

    Thanks in advance for your help!

    #2
    Originally posted by Prov1322 View Post
    I am looking for a "countdown-like" or "distance-from" indicator that will provide real-time, tick-by-tick distance of the current price from a Moving Average (more specifically, an EMA).

    For example, we have numerous types of countdown style tools for showing data such as amount of time remaining in a minute bar or the number of Ticks remaining in a Tick Bar, etc.

    Is anyone aware of the existence of such a "distance-from" tool either within this Community Forum (I did do a search that was not successful) or in outside Forums (such as BMT).

    Thanks in advance for your help!
    The distance of price from the EMA is:
    Code:
    double offset = Input[0] - EMA(Input, Period)[0];
    Should be easy enough to put that in an indicator as the whole calculation. Just work through the tutorials in the NT Help to see how.

    Comment


      #3
      koganam...thanks for the line of code.

      Comment


        #4
        You do not even need to code it.

        Just take the MACD indicator and set the period of the fast EMA to 1. Now the raw MACD shows the distance of price from the second EMA. The signal line smoothes that distance.

        Comment


          #5
          Harry...thanks for your reply.

          Either I'm dense or I did not adequately describe what I am looking to do (Option 3...maybe both?!).

          So far, I do not see this MACD mod, as you recommended, printing the number of Ticks (or any tick-by-tick measure) the EMA is away from the current price level.

          Comment


            #6
            Attached is a chart which shows an EMA(34) and a MACD (1,34,13). If you look at the chart you will understand that the MACD plot shows the distance of price from the EMA.

            I have marked the bar, which is referenced by the data box.

            -> the close of that bar is 1692.00
            -> the value of the EMA(34) is 1684.97
            -> the distance of price from the EMA(34) is therefore +7.03 points
            -> the MACD value is +7.03 points

            In case that you want to see that distance in ticks instead of points, you would need to modify the MACD by dividing the result by the TickSize of the instrument.
            Attached Files

            Comment


              #7
              Harry...thanks for the explanation.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by timmbbo, 07-05-2023, 10:21 PM
              4 responses
              158 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by tkaboris, Today, 08:01 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by Lumbeezl, 01-11-2022, 06:50 PM
              31 responses
              818 views
              1 like
              Last Post NinjaTrader_Adrian  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              5 responses
              15 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by swestendorf, Today, 11:14 AM
              2 responses
              6 views
              0 likes
              Last Post NinjaTrader_Kimberly  
              Working...
              X