Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Keeping First Entry Stop Loss When Extra Entries Are Signaled

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

    Keeping First Entry Stop Loss When Extra Entries Are Signaled

    I have used Position.AveragePrice" when referencing and creating my internal code for my stop on bar update and it always functions well. I am working on a new code where I want to find a way to reference my Trade 1 which uses the string "LE1" is there a way to connect the string properly to a position to only reference that average price, so it does not adjust the whole position average when I scale in. I am using ES and even tried to see if I did a multi data series and used Positions[0] but as expected they are all the same instrument so that did not work.

    Any help would be appreciated!

    #2
    Hello durdcash,

    Once the position is updated the average price would be for both entries. If you needed to reference the first trades average price it would be easiest to store the average price to a variable before submitting the second entry, that variable could then be referenced as many times as needed when you need the price of just the first entry.

    Comment


      #3
      NinjaTrader_Jesse thanks, I got that to work! I just had to go and update all the code with any area it said position.averageprice with my long or short entry price variables I created!

      Comment


        #4
        NinjaTrader_Jesse I am guessing the answer would be yes, but I could technically store any variable that I would want from that first entry and keep calling it during the trade? For instance, I am wanting to also store the min for long trades and the max for short trades. If I call these stored variables where I am calling the average price from would I just put this code in there? Will these be automatically reset when not ina tarde or should I defien something for that too?

        ShortEntryHigh=MAX(High, 20)[0])
        LongEntryLow = MIN(Low, 20)[0])

        Comment


          #5
          Hello durdcash,

          Yes you can do that for any value you need. Those won't get automatically reset so you may want to reset their values later in your logic depending on when you no longer need their values. You would otherwise reset them each time the entry condition is true by setting them.

          Comment


            #6
            NinjaTrader_Jesse Thanks that will be helpful when I add that in. On a different note, what is the easiest way to count trades per entry signal.

            I want to Enter Trade 1 "LE 1" 1 time. (Never have an issue with this one)
            Trade 2 "LE 2" 3 times.
            Trade 3 "LE 3" 3 times.

            I tried using the entries per direction but that did not appear to limit it and from reading around I don't believe that would have been the proper way to do it. It just ends up taking the trade 4 times and then I lose the fourth trade which defeats the idea.

            I am not sure if using TradeCount or accessing Trade performance or a specific int variable is best. Once I have the variable it will be easy to add it into mu conditions to make sure that entry has not entered more than the count wanted. I also then want the variable to reset after each trade to be used and allow it to repeat

            Comment


              #7
              Hello durdcash,

              The easiest way would be to add a few int variables and increment them each time you submit a trade. As part of the entry condition you would need to check that the variable is less than the amount of total trades to be taken. That lets you control when to reset to allow the entries again.

              Entries per direction is used to mitigate extra entries in the same direction, that wouldn't be able to be used as a count of trades taken.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              53 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              130 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              70 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              44 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              49 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X