Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New Simple Indicator

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

    New Simple Indicator

    Good afternoon, I will see an indicator that works perfectly and does almost what I ask but it does the other way around, I want to explain.

    It is an indicator that draws 2 lines, a line is at the opening price and one at the current price, moving up or down depending on the same price movement.

    The question is very basic, I got that I do but right price and what I want is that these colored lines are placed LEFT price and these lines can change their parameters so that they are brought up to 20 candles behind price, 30, 50, etc etc, that's changed the parameters of the indicator. And this is what it takes me hours and I can not do it. Please ask for help sure is a little silly. In short is that exit right instead of the left of the price.

    Besides these 2 lines go on the left of the price I would also like clicking on these lines to modify the parameters indicator open and now does not work properly.

    I have added the code indicator.

    namespace NinjaTrader.Indicator
    {
    /// <summary>
    /// Enter the description of your new custom indicator here
    /// </summary>
    [Description("Enter the description of your new custom indicator here")]
    public class BbFranLine : Indicator
    {
    #region Variables
    // Wizard generated variables
    private double disTicks = 5; // Default setting for DistClose
    private int barrAtras = -41; // Default setting for BarrAtras
    private int barrDel = -70; // Default setting for BarrAtras
    // User defined variables (add any user defined variables below)
    #endregion
    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    CalculateOnBarClose = false;
    Overlay = true;
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    RemoveDrawObjects();
    double cierre=Close[0];
    double apertura=Open[0];
    DrawLine("Inf", true,barrAtras,cierre ,barrDel,cierre,Color.Violet,DashStyle.Solid,7);
    DrawLine("Sup", true,barrAtras,apertura ,barrDel,apertura,Color.Black,DashStyle.Solid,7);
    }

    #region Properties
    [Description("")]
    [GridCategory("Parameters")]
    public double DisTicks
    {
    get { return disTicks; }
    set { disTicks = Math.Max(1, value); }
    }
    [Description("")]
    [GridCategory("Parameters")]
    public int BarrAtras
    {
    get { return barrAtras; }
    set { barrAtras = Math.Max(-100, value); }
    }
    [Description("")]
    [GridCategory("Parameters")]
    public int BarrDel
    {
    get { return barrDel; }
    set { barrDel = Math.Max(-100, value); }
    }
    #endregion
    }
    }
    Thanks in advance.

    Mariano
    Attached Files
    Last edited by MarianoMA; 10-28-2016, 11:23 AM.

    #2
    Hello MarianoMA,

    Thanks for your post.

    If I understand correctly you want your lines to draw to the left of the bar. In that case please make one change to your code. In the OnBarUpdate() method add this as the first line: if (CurrentBar < 20) return;

    Next when you apply the indicator, change BarrAtras to 0, change BarrDel to 20.

    Please see the attached picture.
    Attached Files
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you so much. It does not work.
      Last edited by MarianoMA; 10-28-2016, 02:15 PM.

      Comment


        #4
        Hello MarianoMA,

        Thanks for your reply.

        Can you clarify what the issue is specifically? Does it compile? When you apply to a chart do you see any errors in the "log" tab of the control center?

        Does it produce lines as shown in the picture in my first e-mail?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks you so much. Compiles well. No paints
          Attached Files

          Comment


            #6
            Hello MarianoMA,

            Thanks for your reply.

            Please try this copy which has the changes I originally suggested and I left the variables as you had them, but in the indicator panel, change them there to 0, 20 and 5.
            Attached Files
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,603 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X