Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Volume[BarsSinceEntry()+1)

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

    Volume[BarsSinceEntry()+1)

    I am running the following logic that is trying to say:
    if the volume of the entrybar +1 > the entrybar then exit.
    else exit after entrybar +3
    seems to compile but doesnt work in practice.... the strategy is calconbarclose = false. Stopoffset is a myinput() value. Any ideas?

    Regards


    if
    (Volume[BarsSinceEntry()+1] > Volume[BarsSinceEntry()+0])
    {
    ExitLong(
    "", "");
    ExitShort(
    "", "");
    }


    else
    if (BarsSinceEntry() > stopOffset)


    {
    ExitLong(
    "", "");
    ExitShort(
    "", "");
    }

    #2
    Any errors shown in Control Center logs during runtime?
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      no errors on the log..... the point is to enter the trade... then compare after barsincentry =1 has elapsed... and compare it to the volume of the
      bar that the position was opened in....

      Comment


        #4
        Then what aspect of this does not work? What behavior do you see as is?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          tends to enter multiple trades and stop them immediately.... is there a simpler way tp code ět ? or is it not possible to extract the volume of a bar in which a trade opened after time has elapsed.. ?

          Comment


            #6
            It is possible, but you have to do it at the correct time. I.e. after you have entered the trade.

            You should add some checks like if (Position.MarketPosition == MarketPosition.Long) or something like that.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              will do. just to check:

              Volume[BarsSinceEntry()+0]) is that the volume of the bar that had the position opened...? or the one after it?

              Comment


                #8
                BarsSinceEntry() returns you the bars ago of your entry. If your entry was 1 bar ago, it will return 1. So it is the value of the entry bar.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                630 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                364 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                565 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                568 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X