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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X