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 JoMoon2024, Today, 06:56 AM
      0 responses
      6 views
      0 likes
      Last Post JoMoon2024  
      Started by Haiasi, 04-25-2024, 06:53 PM
      2 responses
      17 views
      0 likes
      Last Post Massinisa  
      Started by Creamers, Today, 05:32 AM
      0 responses
      5 views
      0 likes
      Last Post Creamers  
      Started by Segwin, 05-07-2018, 02:15 PM
      12 responses
      1,786 views
      0 likes
      Last Post Leafcutter  
      Started by poplagelu, Today, 05:00 AM
      0 responses
      3 views
      0 likes
      Last Post poplagelu  
      Working...
      X