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, 05-11-2026, 05:56 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    32 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    195 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    356 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    276 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X