Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Add True False to statement

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

    Add True False to statement

    if(CrossBelow(Index,ob,1))
    Draw.ArrowDown(this, CurrentBar + "arr", false, 1, ob, Brushes.Red, false);
    if(CrossAbove(Index,os,1))
    Draw.ArrowUp(this, CurrentBar + "arr", false, 1, os, Brushes.Green, false);

    using the above I want to add an additional line to each cross over to create a true false statement - when true X = 1

    #2
    Hello DTSSTS,

    Thanks for your post.

    I think you mean: if(CrossBelow(Index,ob,1) && X == 1) // Cross below and X equals 1

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      No I want to create a Plot named X that would equal 1 everytime the Draw took place, so that could be accessed in a strategy, much like an alert. Having looked deeper into the plots on a chart *which were showing at times the Arrow early on the change of the value of the indicator I HAVE come to realize that the plot was really not early 3 bars were plotting exactly at the same time *renko type bar, so it was not actually an early signal. BUT i would still like to add that if possible Thanks

      Comment


        #4
        Hello DTSSTS,

        Thanks for your clarification.

        To add a plot, please see: https://ninjatrader.com/support/help...ml?addplot.htm

        Example: AddPlot(Brushes.Transparent, "MyPlot"); // transparent to hide the plot


        In the OnBarUpdate() then:

        if(CrossBelow(Index,ob,1))
        {
        Draw.ArrowDown(this, CurrentBar + "arr", false, 1, ob, Brushes.Red, false);
        MyPlot[0] = -1; // assign as a negative 1 to know when cross below
        }

        if(CrossAbove(Index,os,1))
        {
        Draw.ArrowUp(this, CurrentBar + "arr", false, 1, os, Brushes.Green, false);
        MyPlot[0] = 1; // assign as a positive 1 to know when cross above
        }



        To use that plot as an input for something else, be sure to add the public output in region Properties:
        Example:

        [Browsable(false)]
        [XmlIgnore]
        public Series<double> MyPlot
        {
        get { return Values[0]; }
        }

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RookieKiwi, Today, 03:38 PM
        2 responses
        11 views
        0 likes
        Last Post RookieKiwi  
        Started by pacman197, Today, 03:17 PM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_JustinD  
        Started by relogical, Today, 03:32 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by AdeptistJune, Today, 02:50 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by handlar, Today, 02:58 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Kate  
        Working...
        X