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 zstheorist, Today, 07:52 PM
        0 responses
        3 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        149 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Started by mattbsea, Today, 05:44 PM
        0 responses
        5 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        33 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        5 views
        0 likes
        Last Post tkaboris  
        Working...
        X