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

Need help with two interesting issues on Strategy Builder

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

    Need help with two interesting issues on Strategy Builder

    Guys,

    I cant seem to find ways to implement the below with No-code Strategy Builder.

    1. How to set Position quantity when building the strategy, so that it enters the given size (in FX lot (1 lot) or nominal value..i.e. 100000 EURUSD) and also for Strategy Analyzing purposes. I tried to to set it on Enter Long / Short in the Conditions window but need correct instruction.

    2. How can I set Exit Long/Short position when candle crosses/closes Below or Above Recent High/Lows.
    Logically, it should be by Look-Back method...
    I tried by setting it as Price (Close) > Cross (Below/Above) > Price (Close) (giving same values for "Look-back Period" and "Bars Ago" but didnt work..need proper explanation.
    This picture shows what I mean:

    Click image for larger version  Name:	recent.jpg Views:	0 Size:	62.1 KB ID:	1147372
    Last edited by heybuilders; 03-19-2021, 06:45 AM.

    #2
    Hello heybuilders,

    Thanks for your post and welcome to the Ninjatrader forums!

    1. How to set Position quantity when building the strategy, so that it enters the given size (in FX lot (1 lot) or nominal value..i.e. 100000 EURUSD) and also for Strategy Analyzing purposes. I tried to to set it on Enter Long / Short in the Conditions window but need correct instruction.
    Please check the NinjaTrader8 version number found in Help>about of the NinjaTrader8 control center. If it is less than 8.0.24.1 then please update to the latest version as there were some changes to the strategy builder in previous versions that may have prevented you from being able to directly enter the value in the quantity field.
    (Release notes from 8.0.24.1: 14773 Fixed Strategy Builder Numeric value was missing for order submission quantity)

    There are two ways to enter order quantities, either directly in the quantity field of the order method (as you tried to do) or leave it as the "default quantity" and when you apply the strategy you can then set the "default quantity" in the strategy parameters. Locate the field "set order quantity" which will by default show "Strategy", click the drop-down arrow and select "Default quantity" and a new field called "Default Quantity" will appear and you can directly enter the number of forex units to buy or sell each time.

    2. How can I set Exit Long/Short position when candle crosses/closes Below or Above Recent High/Lows.
    Logically, it should be by Look-Back method... I tried by setting it as Price (Close) > Cross (Below/Above) > Price (Close) (giving same values for "Look-back Period" and "Bars Ago" but didnt work..need proper explanation.
    Can you clarify what "didn't work" means? Did the order not get placed? Was there an error in the "Log" tab of the control center? Did the order get placed but did not stay? What exit order method did you use? (Perhaps a screenshot of your conditions and exit order would help).
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello heybuilders,

      Thanks for your post and welcome to the Ninjatrader forums!



      Please check the NinjaTrader8 version number found in Help>about of the NinjaTrader8 control center. If it is less than 8.0.24.1 then please update to the latest version as there were some changes to the strategy builder in previous versions that may have prevented you from being able to directly enter the value in the quantity field.
      (Release notes from 8.0.24.1: 14773 Fixed Strategy Builder Numeric value was missing for order submission quantity)

      There are two ways to enter order quantities, either directly in the quantity field of the order method (as you tried to do) or leave it as the "default quantity" and when you apply the strategy you can then set the "default quantity" in the strategy parameters. Locate the field "set order quantity" which will by default show "Strategy", click the drop-down arrow and select "Default quantity" and a new field called "Default Quantity" will appear and you can directly enter the number of forex units to buy or sell each time.

      This one Fixed after Update. Thanks.


      Can you clarify what "didn't work" means? Did the order not get placed? Was there an error in the "Log" tab of the control center? Did the order get placed but did not stay? What exit order method did you use? (Perhaps a screenshot of your conditions and exit order would help).
      This is actually Exit Method (SL) - a condition for it. If price goes against my position, to above/below of recent high or low then Exit Long/Short position.
      It is entered as below. In this case, logic doesnt work. I check it on chart. It doesnt close below/above of last 3 candles (which I meant it to do). Maybe I don't do it properly. Just refer to example image in the original post, need to tell it to close where it says Exit.







      Comment


        #4
        Also, I'd like to clarify further:

        1. Maybe there are other ways to determine Recent High/Low (for placing SL) apart from Look-Back method?

        2. What is difference between Look Back Period and Bars Ago (in Cross above/below situations of Price Conditions window)? When to use them.

        3. How to tell system to open only particular number of positions at a time? Like, if a position opens as per Entry rule - do not enter another position before the first one is closed (even if new Entry condition emerges).

        Comment


          #5
          Hello heybuilders,

          Thanks for your replies.

          Regrettably, your picture in post#3 does not show.

          If I understand correctly you are using ExitLong or ExitShort? Or are you using the set methods in the stops and targets window?

          If possible please post (or repost) your strategy builder conditions for exit.


          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_PaulH View Post
            Hello heybuilders,

            Thanks for your replies.

            Regrettably, your picture in post#3 does not show.

            If I understand correctly you are using ExitLong or ExitShort? Or are you using the set methods in the stops and targets window?

            If possible please post (or repost) your strategy builder conditions for exit.

            Interesting, I uploaded and it shows on here.

            Links



            https://i.postimg.cc/nhLggfCR/recent.jpg

            btw, no
            other SL applied, only fixed TP. so, SL is basically Exit Long/Short Position as Do-Following thing.
            Last edited by heybuilders; 03-19-2021, 01:10 PM.

            Comment


              #7
              Hello heybuilders,

              Thanks for your reply.

              A good way to test if your condition is true is to have the strategy draw on the chart when the condition(s) are true. Here is a short video that will help with visual debugging of your conditions: https://paul-ninjatrader.tinytake.co...MF8xMTMwNTc0MA I recommend that you use these methods while creating your strategy as it provides a means on the chart to see when exactly a (sets) condition is true.

              For the Cross methods, typically you would leave the look back at 1 bar ago. I think that using the close series to see if it crossed over a close price of x bars ago may not be the best criteria. Perhaps price crossing a moving average may work better for you.

              Have you considered using the Stops and targets in the stops and targets window?

              In case you have not seen all the reference materials:
              Here are the educational resource available on the strategy builder:
              Free live webinar every other Thursday at 4:00 PM EST, through this link to all webinars: https://ninjatrader.com/PlatformTraining
              Previous recording of the Strategy Builder 301 webinar: https://youtu.be/HCyt90GAs9k?list=PL...auWXkWe0Nf&t=2
              Help guide for the strategy builder: https://ninjatrader.com/support/help...gy_builder.htm
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_PaulH View Post
                Hello heybuilders,

                Thanks for your reply.

                A good way to test if your condition is true is to have the strategy draw on the chart when the condition(s) are true. Here is a short video that will help with visual debugging of your conditions: https://paul-ninjatrader.tinytake.co...MF8xMTMwNTc0MA I recommend that you use these methods while creating your strategy as it provides a means on the chart to see when exactly a (sets) condition is true.

                For the Cross methods, typically you would leave the look back at 1 bar ago. I think that using the close series to see if it crossed over a close price of x bars ago may not be the best criteria. Perhaps price crossing a moving average may work better for you.

                Have you considered using the Stops and targets in the stops and targets window?

                In case you have not seen all the reference materials:
                Here are the educational resource available on the strategy builder:
                Free live webinar every other Thursday at 4:00 PM EST, through this link to all webinars: https://ninjatrader.com/PlatformTraining
                Previous recording of the Strategy Builder 301 webinar: https://youtu.be/HCyt90GAs9k?list=PL...auWXkWe0Nf&t=2
                Help guide for the strategy builder: https://ninjatrader.com/support/help...gy_builder.htm
                Conditions basically show as text alert - Sell, Closing etc. But this is no my main concern. Also, Stops and Targets have no helpful possibility in my case.

                All I want to achieve is Exiting the Opened position by constructing terms on the Conditions section. There I need to tell system that if Entry happens in a given price level (decided by Entry condition) but later price reverses against that entry and goes beyond number of candles apart (backwards) and price closes above or below of past, lets say, 3 candles, then exit that position. It is an attempt to calculate recent high/low. How to enter this condition properly in the Conditions? This image illustrates it:

                Click image for larger version

Name:	exit2.jpg
Views:	223
Size:	55.6 KB
ID:	1147482


                Comment


                  #9
                  Hello heybuilders,

                  Thanks for your reply.

                  So your exit would be based solely on the price level of a bar 3 bars ago? What if the bar price is less than the entry price?

                  There must be some other criteria that would fit here?


                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_PaulH View Post
                    Hello heybuilders,

                    Thanks for your reply.

                    So your exit would be based solely on the price level of a bar 3 bars ago? What if the bar price is less than the entry price?

                    There must be some other criteria that would fit here?

                    Actually, I wanna check what is in your question. But in fact, Condition doesnt seem to work, so I am confused. I tried Price Candle Close - CrossBelow/Above as well as Greater/Lower - Price Candle Close with Bars Ago (to achieve what is in the previous image) but no avail.

                    But I must say, since I apply certain conditions that follow direction of price, that what you say rarely may happen. Cause entry happens in the direction of market.

                    Comment


                      #11
                      Hello heybuilders,

                      Thanks for your reply.

                      Looking at your screenshot (short entry) what you can do, in the set where you place the entry is to save the value of the maximum high of the previous 3 bars into a double variable. Then in another set, you can check that when you are in a short market position and price crossbove the level to exitshort(). Likewise but opposite, for a long entry, you would use the minimum low price of the previous 3 bars.

                      The indicator MAX() can be set to the High data series and you can specify the period such as 3
                      Reference: https://ninjatrader.com/support/help...aximum_max.htm

                      The indicator MIN() can be set to the Low data series and you can specify the period such as 3.
                      ​​​​​​​Reference: https://ninjatrader.com/support/help...inimum_min.htm

                      Here is a link to the help guide that shows creating a variable: https://ninjatrader.com/support/help...ariablesScreen

                      Here is a link to the help guide that shows checking the current market position: https://ninjatrader.com/support/help...ionComparisons

                      Paul H.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_PaulH View Post
                        Hello heybuilders,

                        Thanks for your reply.

                        Looking at your screenshot (short entry) what you can do, in the set where you place the entry is to save the value of the maximum high of the previous 3 bars into a double variable. Then in another set, you can check that when you are in a short market position and price crossbove the level to exitshort(). Likewise but opposite, for a long entry, you would use the minimum low price of the previous 3 bars.

                        The indicator MAX() can be set to the High data series and you can specify the period such as 3
                        Reference: https://ninjatrader.com/support/help...aximum_max.htm

                        The indicator MIN() can be set to the Low data series and you can specify the period such as 3.
                        ​​​​​​​Reference: https://ninjatrader.com/support/help...inimum_min.htm

                        Here is a link to the help guide that shows creating a variable: https://ninjatrader.com/support/help...ariablesScreen

                        Here is a link to the help guide that shows checking the current market position: https://ninjatrader.com/support/help...ionComparisons
                        thanks. it looks kinda confusing to me, it would be easier to see explanation visually though.

                        Can you also comment on below that I posted earlier:

                        1. Maybe there are other ways to determine Recent High/Low (for placing SL) apart from Look-Back method?

                        2. What is difference between Look Back Period and Bars Ago (in Cross above/below situations of Price Conditions window)? When to use them.

                        3. How to tell system to open only particular number of positions at a time? Like, if a position opens as per Entry rule - do not enter another position before the first one is closed (even if new Entry condition emerges).

                        Comment


                          #13
                          Hello heybuilders,

                          Thanks for your reply.

                          1. Please see my post #11 for the "other ways to determine recent high/low..."

                          2) Difference between lookback period and bars ago is that the lookback can be a number of bars where the bars ago is a specific bar.

                          3) To prevent opening a position while in a position you would add a condition in the entry set to check that the market position is flat. (see link in post #11 for market position).



                          Paul H.NinjaTrader Customer Service

                          Comment


                            #14
                            Thanks I will check.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by rocketman7, Today, 02:12 AM
                            7 responses
                            30 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by guillembm, Yesterday, 11:25 AM
                            3 responses
                            16 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Started by junkone, 04-21-2024, 07:17 AM
                            10 responses
                            149 views
                            0 likes
                            Last Post NinjaTrader_BrandonH  
                            Started by tsantospinto, 04-12-2024, 07:04 PM
                            6 responses
                            101 views
                            0 likes
                            Last Post tsantospinto  
                            Started by trilliantrader, 04-18-2024, 08:16 AM
                            7 responses
                            28 views
                            0 likes
                            Last Post NinjaTrader_BrandonH  
                            Working...
                            X