Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing Arrowup and down doesn't wor

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

    Printing Arrowup and down doesn't wor

    Hi, I try to draw an arrow up or down.... I tried different versions as you can see. But I can't figure it out..... Any suggestions?

    Errors are: The name draw doesn't exist in this context. I also tried it without the dot in drawarrowup.​

    PHP Code:
    // Stellen Sie sicher, dass die folgenden using-Direktiven am Anfang der Datei stehen:
    using NinjaTrader.Cbi;
    using NinjaTrader.NinjaScript.Strategies;
    using System.Windows.Media;
    
    namespace NinjaTrader.NinjaScript.Strategies
    {
        public class MyRangeChartStrategy : Strategy
        {
            private bool previousCandleWasPositive = false;
    
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description = "Eine Strategie basierend auf der Kerzenrichtung in einem Range-Chart.";
                    Name = "MyRangeChartStrategy";
                    Calculate = Calculate.OnBarClose; // Setzen Sie dies entsprechend Ihrer Präferenz.
                    EntriesPerDirection = 1;
                    EntryHandling = EntryHandling.AllEntries;
                }
            }
    
            protected override void OnBarUpdate()
            {
                // Sicherstellen, dass genügend Daten zur Verfügung stehen.
                if (CurrentBars[0] < 1) return;
    
                // Überprüfung der vorherigen Kerze auf positive oder negative Schließung.
                if (CurrentBars[0] >= 1) // Stellen Sie sicher, dass mindestens eine vorherige Kerze vorhanden ist.
                {
                    previousCandleWasPositive = Close[1] > Open[1];
                }
    
                // Logik für den Handel basierend auf der vorherigen Kerze und der aktuellen Kerzenformation.
                if (previousCandleWasPositive)
                {
                    if (Close[0] == High[0] && Open[0] == Close[0]) // Möglicher Long-Eintritt
                    {
                        // Zeichnet einen Pfeil nach oben unter der aktuellen Kerze
                        //Draw.ArrowUp("longArrow" + CurrentBar, 0, Low[0] - TickSize * 2, Brushes.Green);
                        //Draw.ArrowUp(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);
                        Draw.ArrowUp(this, "RSIspkLong" + CurrentBar, IsAutoScale, 3, Input[3] - 2, Brushes.YellowGreen);
                    }
                }
                else
                {
                    if (Close[0] == Low[0] && Open[0] == Close[0]) // Möglicher Short-Eintritt
                    {
                        // Zeichnet einen Pfeil nach unten über der aktuellen Kerze
                        //Draw.ArrowDown("shortArrow" + CurrentBar, 0, High[0] + TickSize * 2, Brushes.Red);
                        //Draw.ArrowDown(this, CurrentBar.ToString(), true, 0, High[0] + TickSize, Brushes.Blue);
                        Draw.ArrowDown(this, "RSIspkShort" + CurrentBar, IsAutoScale, 3, Input[3] + 2, Brushes.PaleVioletRed);
                    }
                }
            }
        }
    }&#8203; 
    

    #2
    Hello Testmaster,

    Have you deleted some of the default using statements from the top of the Script?

    Unless this suggested code is incomplete, the using statements for the DrawingTool class are missing.

    I recommend you create a new script and copy all of the default using statements from this.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    91 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    121 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    72 views
    0 likes
    Last Post PaulMohn  
    Working...
    X