Announcement

Collapse
No announcement yet.

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

    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]; }
        }

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        39 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        64 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        41 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X