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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X