• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems drawing Up Arrow on price chart

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

    Problems drawing Up Arrow on price chart

    After successfully creating several simple strategies in both Strategy Builder, and Ninjascript editor, I decided to try my 1st 'indicator.'

    All it does is draw an arrow below price when a condition is met: price crosses above 50-per SMA.

    I followed instructions from video in this post:
    #2

    I'm getting some odd behavior though:
    As I move through the chart, the arrow positions change, along with the plotted SMA (meaning the SMA moves vertically as the chart scrolls, and does not maintain it's fixed position, relative to price).

    And, dragging the mouse in the price axis does not compress/expand price graph as expected, but only moves SMA and arrows up and down.
    I tried setting 'Auto Scale' both on and off, and neither setting worked properly.

    Can someone explain how to get this working (see relevant code below).


    Code:
            else if (State == State.DataLoaded)
                {                
                    SMA1                = SMA(Close, 50);
                    SMA1.Plots[0].Brush = Brushes.DarkGray;
                    AddChartIndicator(SMA1);
                }
            }
    
            protected override void OnBarUpdate()
            {
                if (BarsInProgress != 0)
                    return;
    
                if (CurrentBars[0] < 1)
                    return;
    
                 // Set 1
                if (CrossAbove(Close, SMA1, 1))
                {
                    Draw.ArrowUp(this, @"ArrowTest Arrow up_1 " + Convert.ToString(CurrentBars[0]), true, 0, (Low[0] + (-1 * TickSize)) , Brushes.LimeGreen);
                }
    
            }

    #2
    Hello Wick Wrangler,

    Thanks for the post.

    I tried the code and don't see what you are describing so this is likely a chart setting.

    Are you applying the indicator to the primary panel and using ScaleJustification Overlay? If so, try using Right instead.

    Could you otherwise post the full indicator so I can test the specific configuration you used?

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

    Comment


      #3
      I may have discovered an intermittent bug.

      After starting up today and retesting the same code--it works.

      Will let you know if it recurs.

      Thanks for response

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by corman, Today, 06:04 AM
      0 responses
      7 views
      0 likes
      Last Post corman
      by corman
       
      Started by brunoviveiros, Today, 06:00 AM
      0 responses
      4 views
      0 likes
      Last Post brunoviveiros  
      Started by JAtrades, Today, 05:20 AM
      4 responses
      10 views
      0 likes
      Last Post JAtrades  
      Started by pol133, Today, 02:35 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Marco  
      Started by timko, Today, 05:12 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Marco  
      Working...
      X