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 prdecast, Today, 06:07 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Christopher_R, Today, 12:29 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by chartchart, 05-19-2021, 04:14 PM
        3 responses
        577 views
        1 like
        Last Post NinjaTrader_Gaby  
        Started by bsbisme, Yesterday, 02:08 PM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by i019945nj, 12-14-2023, 06:41 AM
        3 responses
        60 views
        0 likes
        Last Post i019945nj  
        Working...
        X