Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

avoid crossing over line drawn by strategy

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

    avoid crossing over line drawn by strategy

    Hello, my strategy draws a line from one set point to another within the momentum indicator. On this amount of candles I already have a series that keeps the momentum, what I want is that if there is any crossing above or below, depending on whether it is red or green, of the line that draws my strategy, do not enter. My problem is that I can't get the double of the line. I would like to know if, just as it is given a name "lineX" that marks the entire line, I can obtain a double value over the entire series of the "lineX"
    Attached Files

    #2
    Hello RubenCazorla,

    Are you wanting a chart anchor like the StartAnchor or are you wanting the y-intercept of where a line is being crossed on a specific bar.
    https://ninjatrader.com/support/helpGuides/nt8/line.htm
    https://ninjatrader.com/support/foru...663#post828663
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3

      what I want is the momentum1 of a series of example bars; bar 2 to bar 12, is less than the line drawn by the strategy within the same series of bars, if this is different, do not execute the strategy

      my series of bars would be this;

      Series<double> divmom = new Series<double>(this, MaximumBarsLookBack.TwoHundredFiftySix);
      for(int i = 2; i < 12 && i < Momentum1.Count && Momentum1[i] != null; i++)
      {
      divmom[i] = Momentum1[i];
      }
      for(int i = 0; i < 2; i++) {
      divmom[i] = Double.MaxValue;
      }

      and there is the line;

      Draw.Line(Momentum1, @"LineMom", false, 12, Momentum1[12], 0, Momentum1[2], Brushes.Green, DashStyleHelper.Solid, 1);

      Comment


        #4
        Hello RubenCazorla,

        When you say less than the line '...the momentum1... ...is less than the line drawn...' . What if the line has two anchors at different prices (drawn diagonally)? Will the line always be horizonal?

        What do you consider less than that line? Less than the first anchor of the line? Less than the second anchor of the line? Less than the y-intercept of the line on a bar between the two points?

        Is the code you have suggested the code you want?
        The code you have suggested does not appear to check if the divmom[0] is less than the line.
        Where are you getting stuck?
        Do you have code comparing the momentum1 to the line?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5

          what I want to avoid are these momentum crosses with the line that draws my strategy,
          as in the drawing it is observed
          Attached Files

          Comment


            #6
            Hello RubenCazorla,

            What do you consider crossing a line?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7

              that he does not cross the line is a condition to enter long

              Comment


                #8
                Hello RubenCazorla,

                Without you providing specifics, its hard to advise. Likely, you are wanting to check the y-intercept of a line, and then compare that bar's y intercept on that line to the price from the indicator.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by BGWTEX, Today, 07:20 PM
                0 responses
                3 views
                0 likes
                Last Post BGWTEX
                by BGWTEX
                 
                Started by hayleeabb, Today, 04:21 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_ShawnB  
                Started by mg.watts, Today, 03:17 PM
                1 response
                17 views
                0 likes
                Last Post NinjaTrader_ChrisL  
                Started by JTizz, Today, 01:20 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by omermirza, Today, 12:39 PM
                2 responses
                13 views
                0 likes
                Last Post omermirza  
                Working...
                X