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

Calculating difference between SMA and Last Close in Market Analyzer

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

    Calculating difference between SMA and Last Close in Market Analyzer

    I want to create a simple indicator in Market Analyzer. Any suggestions please?

    - I would like to calculate difference between SMA(200, Close) to previous candle close price (example: 60 min candle close).
    - I do not need to plot on chart. Only on Market Analyzer.
    - I would like to do this for multiple Forex pairs and compare how each market basket is strong or weak overall.

    I searched around and couldn't quite find anything similar. I would appreciate any feedback.

    Thank you,

    #2
    Hello totoro2000,

    Thank you for the post.

    I wanted to check, have you currently tried something that is not working? If so can you provide what you have tried?

    To create an indicator for the Market Analyzer, you would need to create an indicator that has a Plot and then Plot a value. The Value you plot could be a calculated value such as the difference between the SMA and the Close[1] if you want, the plot is just needed for the Market Analyzer indicator column.

    For a simple way to get started, I would likely suggest using the indicator wizard to generate a new indicator with 1 plot. After doing this, you could plot the following for a difference of what you noted:

    Code:
    if(CurrentBar < 1) return;
    double diff = SMA(200)[0] - Close[1];
    Value[0] = diff;
    After creating the indicator and compiling, you could use it in the market analyzer with the Indicator column selecting the plot you created.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ct, 05-07-2023, 12:31 PM
    6 responses
    202 views
    0 likes
    Last Post wisconsinpat  
    Started by kaywai, Today, 06:26 AM
    0 responses
    1 view
    0 likes
    Last Post kaywai
    by kaywai
     
    Started by kevinenergy, 02-17-2023, 12:42 PM
    118 responses
    2,778 views
    1 like
    Last Post kevinenergy  
    Started by briansaul, Today, 05:31 AM
    0 responses
    9 views
    0 likes
    Last Post briansaul  
    Started by traderqz, Yesterday, 12:06 AM
    11 responses
    28 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X