Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limiting consecutive same direction trades

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

    Limiting consecutive same direction trades

    Is there a way in the Ninja Strat Wizard to limit the number of consecutive trades either long or short? I would like to limit the strat to take for example 3 long trades or 3 short trades in a row and then reverse to the opposite direction. Thanks in advance.

    #2
    Hello futures614,

    Thank you for your note.

    This would not be possible with the Strategy Wizard.

    To find the number of consecutive orders in a direction you will need to use a loop:

    (edit)
    Code:
    consecutiveOrders = 0;
    for (int i=Performance.AllTrades.Count; i>0; i--)
    {
    //Print(i+" - "+Performance.AllTrades[i-1].ToString());
    if (Performance.AllTrades[i-1].Entry.MarketPosition == Performance.AllTrades[[B]Performance.AllTrades.Count-1[/B]].Entry.MarketPosition)
    {
    consecutiveOrders++;
    }
    else
    {
    break;
    }
    }
    Print(consecutiveOrders);
    This code would print the number of trades where the entry order position matches the last trade's entry order position.


    You could also choose to increment a value in OnOrderUpdate or OnExecution that resets when an order is in the opposite direction.
    Last edited by NinjaTrader_ChelseaB; 08-04-2014, 03:39 PM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you ChelseaB

      I appreciate your feedback.

      Comment


        #4
        Conditions & actions ? for the strategy wizard

        I'm trying to use the slope or rising/falling of a trend indicator in my conditions and actions for filtering longs and shorts. I would appreciate any help as how that can be done in the strat wizard. Thanks in advance.

        Comment


          #5
          Hi futures614,

          Attached is a screenshot of how to use Rising in the Strategy Wizard.

          This example looks to see if the ADL is rising.
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thank you ChelseaB

            I appreciate your time and response.

            Comment


              #7
              I followed the screenshot example and I receive the following error message:
              Return type of left expression 'Boolean' and right expression 'ADL' do not match. I get the same error when I try to use the StepMa indicator that I'm trying to incorporate into my strat.
              I would appreciate any help you can offer. thanks you
              Last edited by futures614; 08-05-2014, 10:04 PM.

              Comment


                #8
                The name of the old indicator(StepMaV72Sharky) in the strat wizard is not the same name as the indicator under tools/edit ninjascript/indicator(StepMa). I thought the old indicator showing in the strat would be replaced when I downloaded a newer version. I deleted all the files of the old indicator I could find, restarted Ninja and still find the V72 in the strat wizard. How do I get the newer version to show in the strat wizard? The new version shows in my list when I do a chart.
                Last edited by futures614; 08-05-2014, 10:03 PM.

                Comment


                  #9
                  Hi futures614,

                  May I have a screenshot of the Strategy Analyzer with the Rising condition you are making?

                  To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

                  For detailed instructions please visit the following link
                  http://take-a-screenshot.org/


                  Regarding the StepMaV72Sharky indicator, the way it shows in the Strategy Wizard should be the same as the Indicators list from a chart (but may be different from the list of indicators in Tools -> Edit NinjaScript -> Indicator...)

                  Have you closed the Strategy Wizard and reopened it to see if the list has updated?

                  May I have a screenshot of how this appears in the Indicators window from a chart?
                  May I have a screenshot of how this appears in the Strategy Wizard?

                  I look forward to your reply.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Requested screenshot of strat wizard

                    Originally posted by NinjaTrader_ChelseaB View Post
                    Hi futures614,

                    May I have a screenshot of the Strategy Analyzer with the Rising condition you are making?

                    To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

                    For detailed instructions please visit the following link
                    http://take-a-screenshot.org/


                    Regarding the StepMaV72Sharky indicator, the way it shows in the Strategy Wizard should be the same as the Indicators list from a chart (but may be different from the list of indicators in Tools -> Edit NinjaScript -> Indicator...)

                    Have you closed the Strategy Wizard and reopened it to see if the list has updated?

                    May I have a screenshot of how this appears in the Indicators window from a chart?
                    May I have a screenshot of how this appears in the Strategy Wizard?

                    I look forward to your reply.
                    Sorry for the delay. Attached is the screenshot of the strat wizard and thanks for your help in directing me to do a screenshot. I did learn that the file in the strat wizard and in my indicator list is one and the same.
                    Attached Files

                    Comment


                      #11
                      Better screen shot

                      I think this screenshot is better than the previous one I sent. Thanks for your indulgence.
                      Attached Files

                      Comment


                        #12
                        Hi futures614,

                        May I also have a screenshot of the Indicator window from a chart?

                        (Right-click chart -> select Indicators... -> scroll to StepMaV72Sharky)
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Indicator screen from chart

                          Hi,

                          Here is the screen shot from the indicator screen on my chart.
                          Attached Files

                          Comment


                            #14
                            Hi futures614,

                            Thank you for the screenshots.

                            Just to confirm, you have recompiled and restarted NinjaTrader before taking these screenshots correct?

                            If so, I'd like to take a look at this with you. Please send an email to platformsupport [at] ninjatrader [dot] com. In the email, please add a link to this forum thread.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Yes to your question. I'm getting ready to send email now.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by DayTradingDEMON, Today, 09:28 AM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by cmtjoancolmenero, Yesterday, 03:58 PM
                              8 responses
                              31 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by helpwanted, Today, 03:06 AM
                              2 responses
                              22 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by navyguy06, Today, 09:28 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post navyguy06  
                              Started by rjbtrade1, 11-30-2023, 04:38 PM
                              2 responses
                              77 views
                              0 likes
                              Last Post DavidHP
                              by DavidHP
                               
                              Working...
                              X