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

Market Analyzer displays Close Price and Not Indicator Plot

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

    Market Analyzer displays Close Price and Not Indicator Plot

    My Indicator that I added to the Market Analyzer is displaying Closing price of the Instrument(see attachment) - dont know why Price is in the indicator part - it is not Plotting "TPS" ??

    The Indicator works in the Chart but not the Market Analyzer - am I missing something in my code specific for the market analyzer ?


    #region Variables
    // Wizard generated variables
    private int overSoldLong = 25; // Default setting for OverSoldLong
    private int overBoughtLong = 70; // Default setting for OverBoughtLong
    private int sellShort = 75; // Default setting for SellShort
    private int coverShort = 30; // Default setting for CoverShort
    private int biasLong = 0;

    // User defined variables (add any user defined variables below)
    #endregion

    protected override void Initialize()
    {

    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "TPS"));
    Overlay = false;

    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.
    // Do not calculate if we don't have enough bars
    if (CurrentBar < 200) return;
    double value_SMA = SMA(Close, 200)[0];
    double curr_value_RSI = RSI(Close, 2, 0)[0];
    double prev_value_RSI = RSI(Close, 2, 0)[1];
    if ((curr_value_RSI> overBoughtLong ) | (Close[0] < value_SMA) )
    {
    biasLong = 0;
    }
    if (biasLong>0 & Close[0] < Close[1] & Close[0] > value_SMA)
    {
    biasLong = biasLong + 1;
    }
    else if ((curr_value_RSI < overSoldLong) & (prev_value_RSI < overSoldLong) & (Close[0] > value_SMA) )
    {
    biasLong = 1;
    DrawLine("tag1", false, 1, prev_value_RSI, 0, curr_value_RSI, Color.LimeGreen, DashStyle.Dot, 2);
    }
    ;
    TPS.Set(biasLong);
    }

    #2
    Hello mefTrader,

    Thank you for your post.

    Your issue in the Market Analyzer is this line:

    if (CurrentBar < 200) return;

    The Market Analyzer only has a lookback of 50 bars by default. You'll need to increase this for your column to at least 200, since your SMA requires that many bars of lookback to calculate. To do so, right click > Columns > select your indicator column and change the "# of bars to look back" setting to over 200, then click OK. You should then see the correct value in the Analyzer.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thanks Kate tried that and that worked thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      19 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X