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 kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    58 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    46 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    37 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    156 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X