Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder - Using a Buy/Sell indicator

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

    Strategy Builder - Using a Buy/Sell indicator

    Hi There,

    Not sure if this post exists, so sorry if it already has been asked.

    I'm wanting to know how to develop a strategy, using the strategy builder, to make an order based on a buy and sell indicator output.

    For example, I have this custom indicator that prints arrows to enter long or short based on breakouts or breakdowns. I've used the alert method within the indicator to fire a market order when the indicator displays on chart after bar close. The results are not great as the indicator is active all the time (I only want set hours) and also I would like to use limit orders with a tick offset and disappear after 3 or 4 bars have printed on any time frame.

    Is there a way to extract the indicator output and use this in the strategy builder to go long with limit order when the indicator prints buy or go short with limit order when the indicator prints sell.

    Any help would be appreciated.

    Thanks in Advance,

    Marco

    #2
    Hello marco231,

    Thank you for your inquiry.

    When you take a look at the list of indicators available within the Strategy Builder is that custom indicator listed? If so, try printing the plot values to see what it is exposing for data. If one of the plots is a signal, you would be able to use that for your logic.

    Otherwise, if there are no plots (it is not listed in the Strategy Builder) or the plots are not the right value you would not be able to accomplish this from the Strategy Builder. You cold reach out to the developer of the indicator about exposing the buy/sell signals as plot values.

    Please let me know if I can assist further.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Hi Gaby,

      It is listed in the available list of indicators, see below the properties available. Its the smartchannels indicator

      Click image for larger version

Name:	image.png
Views:	508
Size:	21.3 KB
ID:	1296754

      How do I go ahead and print the plot values as for now I'm comparing this statement - numeric value =0 not equal indicator then go long (when the indicator has the plot as buy. This logic works when you set it up as an alert under the indicator and only fires off once. So when you get a sell signal like below, it would enter as a market order on the next candle. However in the strategy builder when using this logic the strategy continuously takes trades and can take 100 trades in a day. Where as the alert would only take the number of signals that was given.

      Click image for larger version

Name:	image.png
Views:	482
Size:	79.6 KB
ID:	1296755

      Let me know if you can assist.

      Comment


        #4
        Hello marco231,

        In the actions, under Misc > select Print. Click on "set" next to message, then you can set up your print statement.

        The attached screenshot demonstrates printing out the current value of a 14 period SMA. String 0 is a text label, and String 1 I have set to print out the value of the SMA.

        Please let me know if I can assist further.
        Attached Files
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Awesome , thanks this works! and fires only when the candle prints a signal.

          Thank you so much.

          Comment


            #6
            Originally posted by marco231 View Post
            Awesome , thanks this works! and fires only when the candle prints a signal.

            Thank you so much.
            marco231 can you please share how you were able to get this to work? I use a similar indicator and I tried the print solution above and I get the same results.

            Comment


              #7
              Make sure your logic is calculate on bar close, and try using other conditions. Like Close of previous candle must be below 50 EMA or SMA. or Only take shorts if price is under Vwap or take longs if above vwap.

              Comment


                #8
                Originally posted by bnoisette View Post

                marco231 can you please share how you were able to get this to work? I use a similar indicator and I tried the print solution above and I get the same results.
                I ended up reviewing my code and there was additional information , you need make sure your market position is flat as part of the condition you can do something like this , && (Position.MarketPosition == MarketPosition.Flat)) . So when you get a signal, it will check 1 are you in a trade (from a previous signal - if so do not open another trade), if you are flat and you get a signal then enter the trade.

                Comment


                  #9
                  Originally posted by marco231 View Post

                  I ended up reviewing my code and there was additional information , you need make sure your market position is flat as part of the condition you can do something like this , && (Position.MarketPosition == MarketPosition.Flat)) . So when you get a signal, it will check 1 are you in a trade (from a previous signal - if so do not open another trade), if you are flat and you get a signal then enter the trade.
                  Yeah I have that. This is what I have tried and it is not working

                  if ((0 == VolumeBasedBuySellSignals1.BuySignal[1])
                  && (BarsSinceExitExecution(0, "", 0) > 3)
                  && (Position.MarketPosition == MarketPosition.Flat))
                  {
                  Print(@"VolumeBasedBuySellSignals.BuySignal[0]:" + Convert.ToString(VolumeBasedBuySellSignals1.BuySig nal[0]));​

                  Comment


                    #10
                    Originally posted by bnoisette View Post

                    Yeah I have that. This is what I have tried and it is not working

                    if ((0 == VolumeBasedBuySellSignals1.BuySignal[1])
                    && (BarsSinceExitExecution(0, "", 0) > 3)
                    && (Position.MarketPosition == MarketPosition.Flat))
                    {
                    Print(@"VolumeBasedBuySellSignals.BuySignal[0]:" + Convert.ToString(VolumeBasedBuySellSignals1.BuySig nal[0]));​
                    is this a free indicator? the Volume Base Buy Sell Signals? It's hard to understand what is going on unless you share the code so that I can review and help you out. Otherwise we'll be doing a lot of back and forth here.

                    Comment


                      #11
                      If you can share the source code of your script + where I can download the indicator then I can review your code for you and give better guidance on why the issue is occuring.

                      Comment


                        #12
                        Originally posted by marco231 View Post
                        If you can share the source code of your script + where I can download the indicator then I can review your code for you and give better guidance on why the issue is occuring.
                        Here you go. The indicator is there as well
                        Attached Files

                        Comment


                          #13
                          Also the sell signal is committed out as I was trying to get the buy signal to work properly first.

                          Comment


                            #14
                            Originally posted by bnoisette View Post
                            Also the sell signal is committed out as I was trying to get the buy signal to work properly first.
                            Thanks, I've managed to load your script and get it to take orders. The problem you had was that you are checking if the buy or sell signal =0 , when in actual fact it will never be 0 (it is always be NA or a number). The number it equals is the price the marker is created, see below image of highlighted green order circled in black, see the sell signal is NA in this instance. So the condition you need to check is (0 != VolumeBasedBuySellSignals1.BuySignal[1]).

                            The other thing I noticed was this condition && (BarsSinceExitExecution(0, "", 0) > 3), I commented it out to get it to take a trade. You need to refine what this is as I'm not sure what this is checking. I had it active and it didn't take any trades over 5 days 23 hours of the market open.

                            Anyway best of luck with your strategy, It looks like a great piece of work coming together !

                            Click image for larger version

Name:	image.png
Views:	438
Size:	336.9 KB
ID:	1312036

                            Comment


                              #15
                              I forgot to mention, if you run into little problems like this try painting the background for order execution and reviewing your order entry conditions and also open the data box to get an understanding of what the indicators are printing out (saves time from having to manually use the print function).

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Zazzgram91, 04-01-2025, 01:49 PM
                              5 responses
                              60 views
                              0 likes
                              Last Post NinjaTrader_ChristopherJ  
                              Started by pjsmith, 10-01-2019, 08:59 AM
                              26 responses
                              1,990 views
                              0 likes
                              Last Post nephew94  
                              Started by Str8boominit, 04-14-2025, 06:03 PM
                              6 responses
                              80 views
                              0 likes
                              Last Post Str8boominit  
                              Started by TAJTrades, Today, 09:01 AM
                              5 responses
                              29 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by quantyse_ntforum, 03-10-2025, 09:05 AM
                              14 responses
                              244 views
                              0 likes
                              Last Post dakensei  
                              Working...
                              X