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

singel entry per day

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

    singel entry per day

    Hi,

    I built a multi time frame strategy in the strategy builder. Is it somehow possible to limit the StopLongEntry to just one entry per day when using the strategy builder?

    Thanks in advance!

    #2
    Hi elnoppo, thanks for your note.

    That could be done with a simple Boolean variable. Create the bool variable in the Inputs and Variables section and set it to true. After that, add the bool check to your entry condition, if it is true, trade. After that, set the boolean to false in your exit condition. This will set up a one-time trade switch for the strategy.

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,

      thanks for your answer. I have got two quesions regarding your proposal:

      1. How or where can I set the boolean to false once I entered a long position. I am using a trailing stop in the "Stops and Targets"
      2. As far as I can see your proposal would only allow a one-time switch - correct? I would like to limit the strategy to one entry per day not one entry in total. Is that possible?

      Thanks again.

      Comment


        #4
        Hello elnoppo,

        Thank you for the reply.

        1). You could do this in addition to your entry, where you currently have the action to enter the position you could set the bool to false there. Chris had assumed you wanted to disable this during the Exit condition, if you are using Targets you would want to toggle this right after entering the position or in the entry condition after you Enter Long or Short position.

        2). Correct, I don't see Chris provided details on how to reset the bool so it would essentially only be able to be set to false and never back to true. You would have to disable/re enable the script to see that toggled back to true.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Dear Jesse,

          thanks for the quick response.

          Regarding the two points:

          1. I will try what you mentioned and see if it works.

          2. Understood, but I think that is not exactly what I am looking for. I think I should describe my problem in more detail: I am having a multi-time frame approch where the primary time series is set to 1 day. The strategy shall buy if e.g. I have got an upward trend in the last couple of days. Generally that works fine. However, when I am backtesting the strategy with a shorter time frame I still get several intraday long entries.

          What I actually want from the backtesting is to get maximum 1 entry per day in combination with a trailing stop, selling my long position whenever the threshold is reached.

          Thanks again.

          Comment


            #6
            Hello elnoppo,

            Thank you for the reply.

            Please excuse my last post I should have continued my statement with some additional information.

            The provided logic could apply to that situation however if you wanted to reset it daily you will need to toggle the variable at the session open.

            The strategy builder is not able to do BarsInProgress greater than 0 logic so what you are asking would mean your primary series needs to be the more granular series and the secondary is the daily. That would allow for resetting the bool at the beginning of the session using misc -> First bar of session.

            A set 1 could be made with a condition checking if it is the first bar of session, if so toggle the bool back to true. You would use the entry or condition to set it to false again.

            The alternative is to unlock the code and add a BarsInProgress condition:

            Code:
            if(BarsInProgress == 1 && Bars.IsFirstBarOfSession) 
            {
              //reset variable code here. 
            }
            I look forward to being of further assistance.




            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by giulyko00, Yesterday, 12:03 PM
            2 responses
            10 views
            0 likes
            Last Post giulyko00  
            Started by r68cervera, Today, 05:29 AM
            0 responses
            3 views
            0 likes
            Last Post r68cervera  
            Started by geddyisodin, Today, 05:20 AM
            0 responses
            6 views
            0 likes
            Last Post geddyisodin  
            Started by JonesJoker, 04-22-2024, 12:23 PM
            6 responses
            36 views
            0 likes
            Last Post JonesJoker  
            Started by GussJ, 03-04-2020, 03:11 PM
            12 responses
            3,241 views
            0 likes
            Last Post Leafcutter  
            Working...
            X