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 WHICKED, Yesterday, 11:12 PM
        0 responses
        2 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by AdeptistJune, Yesterday, 08:08 PM
        1 response
        6 views
        0 likes
        Last Post bltdavid  
        Started by GKbowen, Yesterday, 04:03 PM
        3 responses
        12 views
        0 likes
        Last Post bltdavid  
        Started by bojim, Yesterday, 08:35 PM
        0 responses
        4 views
        0 likes
        Last Post bojim
        by bojim
         
        Started by jamestrader21x, Yesterday, 07:53 AM
        8 responses
        34 views
        0 likes
        Last Post NinjaTrader_Kate  
        Working...
        X