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

Scalping - Reversal trading and reentry based on last signal after session exit

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

    Scalping - Reversal trading and reentry based on last signal after session exit

    Dear support team,

    I'm new to NT8 strategy builder, trying to build a strategy that does reversal trading based on opposite signals. Say, if I'm long, I get a sell signal, then I want to close the long and enter short. Do you have an example that I can refer to?

    "exit on session close" - I want to exit all my open positions based on session close and re-enter again after session opens, based on my last signal. Could you please guide me with this implementation.

    On bar close - My buy sell signals are triggered after the bar closes, So, I enter my order in next bar, when I do so, I'm trying to enter at better price, by using the limit order. But the Bid/ask prices may not get filled. I want to replace the order at better price. I'm using 15min candles in NQ, not sure how to make buy strategy to buy at low price of the candle and sell at high price. Could you please suggest me some examples on enter limit order and exit limit orders prices?

    Thankyou,
    Murali

    #2
    Hello radhmu978,

    Thanks for your post.

    I'm new to NT8 strategy builder, trying to build a strategy that does reversal trading based on opposite signals. Say, if I'm long, I get a sell signal, then I want to close the long and enter short. Do you have an example that I can refer to?
    All entry methods will automatically reverse an existing position. So if you are in a long position and go short, the short entry method will automatically detect and 1st close the long position and will then enter orders to leave you in the desired short position. An example can be found in your trading platform called sample MA Crossover which is an always-in strategy that changes directions as the moving averages cross.

    "exit on session close" - I want to exit all my open positions based on session close and re-enter again after session opens, based on my last signal. Could you please guide me with this implementation.
    One way to do this would be to create some logic that is run say 1 minute before the end of the session where you would use the Strategy>MarketPosition to set a bool true if it is long or a different bool if it is short. Then use another time condition on the start of the next session to enter a position based on the bool. If the bools are not true then there was no position. If the long bool is true then you can have a set place an entry order based on the time condition and the bool. You would also use that set to reset the bool variable back to false.

    On bar close - My buy sell signals are triggered after the bar closes, So, I enter my order in next bar, when I do so, I'm trying to enter at better price, by using the limit order. But the Bid/ask prices may not get filled. I want to replace the order at better price. I'm using 15min candles in NQ, not sure how to make buy strategy to buy at low price of the candle and sell at high price. Could you please suggest me some examples on enter limit order and exit limit orders prices?
    Limit type orders in the strategy builder will automatically be canceled if they are not filled in the bar that they are placed. To be able to buy or sell at the low or high of a currently forming bar is a predictive element that I could not advise on. Here is a link to a post where there is an example of using limit type orders in a strategy: https://ninjatrader.com/support/foru...on#post1174873 The focus of the example is how to maintain the these orders for more than just one bar.

    In case you have not reviewed ll of the materials 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
    Tutorial using the Strategy Builder (Titled "Creating the Strategy by the Wizard): https://ninjatrader.com/support/help..._cross_ove.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you, I will go over the links shared. My custom indicator is not visible in NT8 strategy builder, Could you please let me know how to get this added?

      Comment


        #4
        Hello radhmu978,

        Thanks for your reply.

        Is the custom indicator something you have built or is purchased from a 3rd party?

        If from a 3rd party you would need to reach out to them for assistance in adding it.

        If you created it, please open the Strategy Builder and in a set's conditions click on the "indicators" folder and scroll through there, do you see the indicator listed?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          it is a custom indicator I created in NT8, but that is not displayed in the list of indicators.

          Comment


            #6
            please check the screenshot, my custome indicators are visible in NT8 script editor, but not under the strategy builder Conditions and Action -> add -> indicator list
            Attached Files

            Comment


              #7
              Hello radhmu978,

              Thanks for your reply.

              In order to see/use your indicator in the Strategy Builder, the indicator must have/use a plot.

              You can use a "Hidden" plot if you want to provide a "signal" to the strategy. Typically the signal would be a +1,0, or -1. The signal type plot can be set to a transparent bush so it does not change the current display of the indicator and the strategy (and market analyzer) can read a transparent plot.

              An example of this is in the indicator CandleStickPattern where the hidden plot called "PatternFound". At the top of the OnBarUpdate() the plot is assigned a value of 0 (zero), if in the subsequent code a selected pattern is found the plot is assigned a value of 1. A strategy builder strategy could then react to the signal plot being a value = to 1.

              Reference: https://ninjatrader.com/support/help...ml?addplot.htm
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                ok got it. I used to have plots in my indicator, recently commented those to aviod plaoting on the charts. I also have exposed variables and bool that sends buy and sell signals. Let me add those back and retry. Thank you so much for your help.

                Comment


                  #9
                  I still see an issue in exposing the Bool variables from indicators to strategy. Not able to see the BearIndication and BullIndication. I implemented the logic following the sample bool series and exposed variable.

                  ##

                  if(Short)

                  bullIndication[0] = (true);
                  bearIndication[0] = (false);

                  if(Short)
                  bullIndication[0] = (false);
                  bearIndication[0] = (true);
                  ##

                  [Browsable(false)]
                  [XmlIgnore]
                  public Series<bool> BearIndication
                  {
                  get { return bearIndication; } // Allows our public BearIndication Series<bool> to access and expose our interal bearIndication Series<bool>
                  }

                  [Browsable(false)]
                  [XmlIgnore]
                  public Series<bool> BullIndication
                  {
                  get { return bullIndication; } // Allows our public BullIndication Series<bool> to access and expose our interal bullIndication Series<bool>
                  }

                  Attached Files

                  Comment


                    #10
                    Hello radhmu978,

                    Thanks for your reply.

                    In a strategy builder strategy, you can only work with indicators that provide plots.

                    Change your bools to simple plots of 1 for true and 0 for false, or as you wish.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      using the Bloodhound comparison solver I'm able to view these booleans, but for NT8 strategy, I need to make it as a plot? How come an indicator like BloodHound developed on top of NT8 platform has this capability without support from NT platform. Am i missing something fundamental concept here? I want to build strategies on NT8 directly rather than depending on 3rd party indicators. Please refer to the screenshot attached and kindly suggest.


                      Attached Files

                      Comment


                        #12
                        Hello radhmu978,

                        Thanks for your reply.

                        To access public bools from an indicator in a strategy you would need to work directly in a Ninjascript built strategy. The Strategy Builder, which was designed to provide simple strategies, does not recognize public bools and if you want to use only the strategy builder then the indicator would need to provide plots that can be read by the strategy builder as I have previously advised.

                        I could not advise anything about 3rd party software.
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          Hi Paul,

                          How to get the count of open positions ? I want to know the long or short and quantity of the position. Do you have an example? Could you please give me some reference to exitsing APIs?

                          Thankyou,
                          Murali

                          Comment


                            #14
                            Hello Murali,

                            Thanks for your reply.

                            It would be helpful if you can clarify if this new inquiry is related to the Strategy Builder or are you looking for Ninjascript references?

                            Paul H.NinjaTrader Customer Service

                            Comment


                              #15
                              strategy builder, I have 2 major concerns,

                              1. Not able to track my open positions, I need to get the quantity of open account positions, long or short.
                              2. Trying to enter at the open of the next bar, I use Heikinashi, but still, trying to understand if entering using market order on tick chart help to get a better price.

                              Please clarify.

                              Thankfully,
                              Murali

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by DJ888, Today, 10:57 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by MacDad, 02-25-2024, 11:48 PM
                              7 responses
                              158 views
                              0 likes
                              Last Post loganjarosz123  
                              Started by Belfortbucks, Today, 09:29 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post Belfortbucks  
                              Started by zstheorist, Today, 07:52 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post zstheorist  
                              Started by pmachiraju, 11-01-2023, 04:46 AM
                              8 responses
                              151 views
                              0 likes
                              Last Post rehmans
                              by rehmans
                               
                              Working...
                              X