Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleBreakoutStrategy

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

    SampleBreakoutStrategy

    Hi Ninjas,
    I modified the SampleBreakoutStrategy the way it goes long when higher than highesthigh and goes short when lower then lowetlow and I am getting following info at TraceOrders:
    22.9.2008 15:31:00 Ignored PlaceOrder() method at 22.9.2008 15:31:00: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=1246,75 SignalName=Sell short' FromEntrySignal='' Reason='An Enter() method to submit an entry order has been ignore. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.'

    I read through article related this and I do not know what is wrong. I do no use SetStopLoss() method neither EnterLongLimit() etc.

    Please, can you geve me an advice why I can not use EnterLongStop() and EnterShortStop() at the same time?
    Thank you!
    Vladimir

    #2
    Hello,

    You cannnot have a long and a short at the same time. Our development team is aware that this is something that traders desire and it is being considered.

    This is the section you want to read regarding this:

    Interal Order Handling Rules that Reduce Unwanted Positions
    NinjaTrader is a real-time live trading platform and thus we need to ensure that we prevent situations in real-time where you may have multiple orders working accomplishing the same task. An example of this would be if your strategy had a target limit order for 1 contract working and then your strategy issued a market order to close the position. This is dangerous since it could result in both orders getting filled and instead of having a flat position you are now short! To prevent these types of situations, there are some "under the hood" rules that a NinjaScript strategy follows when order methods are called.
    For the most part, you do not need to be intimately familiar with these rules as you develop your strategies, its all taken care of for you internal within a strategy. If a rule is violated, you will be notified through an error log in the Control Center log tab when running a strategy in real-time or in a backtest.
    The following rules are true per unique signal name excluding market orders:


    Methods that generate orders (excluding market orders) to enter a position will be ignored if:
    • <LI class=rvps1>A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction <LI class=rvps1>A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
    • The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction


    Methods that generate orders to exit a position will be ignored if a strategy position is open and:
    • <LI class=rvps1>An order submitted by an enter method (EnterLongLimit() for example) is active and this entry order is used to open a position in the opposite direction
    • An order submitted by a set method (SetStopLoss() for example) is active


    Set() methods that generate orders to exit a position will be ignored if a strategy position is open and:
    • <LI class=rvps1>An order submitted by an enter method (EnterLongLimit() for example) is active and this entry order is used to open a position in the opposite direction
    • An order submitted by an exit method (ExitLongLimit() for example) is active

    Here is the direct link for this information:
    DenNinjaTrader Customer Service

    Comment


      #3
      Thank you Ben for your reply. I have to find another way how to solve this. I can solve easily in strategy by condition with Market enter, however in backtesting it enters one bar later... Or is any way how to solve it in backtesting too?
      Regerds!
      V.

      Comment


        #4
        Hello,


        All executions in backtest must be placed on the bar after the signal bar. This has to be the case because only OHLCV information is available on each bar. This link may help:
        DenNinjaTrader Customer Service

        Comment


          #5
          Yes I understand the logic, but if I will backtest breakout strategy and I will enter stop order on the close - it will be filled on next bar, however if I will set condition which will be filled by market order - it will be fillet one bar later.

          Comment


            #6
            Hello,


            I do not understand what you are after. However here is my advice:

            - No matter what type of order you place, they will always be submitted on the bar after your signal bar in backtesting

            - Check your logic.

            - Eliminate any code that is putting order in, in opposite directions as you mention prior.
            DenNinjaTrader Customer Service

            Comment


              #7
              Hi Ben,
              thank you for helping me. I tried to check the strategy behaviour on really basic level step by step and found I am doing some very basic mistake. I used strategy wizard and build simple set which says at 15:30 set Variable0as high and Variable1 as low and plot on chart red line at Variable0 value and blue at Variable1 value. After backtest it print only second one line. Please, can you tell me where is mistake?
              Thank you!
              V.
              Attached Files

              Comment


                #8
                Reason is because you are using the same string name for both of your lines. Please use unique names for the two separate lines.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thank you Josh for your help! It works now, including strategy!

                  Comment


                    #10
                    Hi Ninjas,
                    I prepared small picture to explain what I am not able to solve:
                    If I am backtesting, a break at (low-1tick) 15:36 bar, I can do it by

                    1. EnterShortStop() method, which give me a correct result, however I am not able to use at the same time EnterLongStop for high becasue of "Internal Order Handling Rules"

                    2. EnterShort() method after filling conditions, which works on both sides, however is not precise, in this sample is diff. 2 points.

                    Can you give me an advice how to be able to enter on the same price as in sample 1 and be able to solve at the same time break to Long too?

                    Thank you for your help!

                    Vladimir
                    Attached Files

                    Comment


                      #11
                      Hi Vladimir,

                      The reason you cannot place your EnterLongStop() order can be several depending on the exact scenario the order is in when it was submitted. Please see the bottom of this page for a detailed description of all the Internal Order Handling Rules: http://www.ninjatrader-support.com/H...verview36.html

                      In essence, you cannot submit an EnterLongStop() order while having another EnterShortStop() order active.

                      EnterShort() is a market order and as such it is not guaranteed any fill price. Also, in backtesting you are not able to trade on the signal bar. The signal bar is already closed so earliest possible trade time is the next bar which is what you are seeing.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by algospoke, Yesterday, 06:40 PM
                      2 responses
                      20 views
                      0 likes
                      Last Post algospoke  
                      Started by ghoul, Today, 06:02 PM
                      3 responses
                      14 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by jeronymite, 04-12-2024, 04:26 PM
                      3 responses
                      45 views
                      0 likes
                      Last Post jeronymite  
                      Started by Barry Milan, Yesterday, 10:35 PM
                      7 responses
                      21 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by AttiM, 02-14-2024, 05:20 PM
                      10 responses
                      181 views
                      0 likes
                      Last Post jeronymite  
                      Working...
                      X