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

reference strategy within a strategy using Wizard

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

    #16
    Originally posted by CactusMo View Post
    This is live trading. You can see the image of my trade in my communication box #9 where I attached two images showing the trade execution. Trying to set my strategy to enter with BarOnClose True, but Exit with BarOnClose False. Don't seem to be able to make that work.
    Your code says: "If the current Ask is less than the HeikenAshi Low 2 bars ago, exit with a Market Order."
    1. You are using a market order, so your exit is essentially indeterminate. You are giving the market counter-party permission to give you whatever price happens to be when your order gets to the execution point, as determined by the counter-party. Therefore, we cannot even determine whether your exit has any relation to the close of any bar other than the relevant HeikenAshi bar itself.
    2. We do not know how far the Ask was below the relevant HeikenAshi bar either, so we cannot know where the trigger price was.

    You will have to examine your log and relate the price action properly to the chart.

    If you want your exit order to execute when hit, it must be a sitting order, not one that is triggered dynamically. Issue an ExitLongStop() at the relevant price. A sitting Stop order is executed when hit: making the CalculateOnBarClose property irrelevant.

    Let me answer your specific question clearly. Your question was: "I don't see where I have the choice of making each Set in the Condition Editor to choose on BarClose or not. Am I wrong?" The answer is: You are not wrong. You cannot do that in the Wizard, and doing it in code will still be extremely tricky.

    I will not say that it is impossible to use CalculateOnBarClose in a manner where you can switch it between true and false. Many unsupported things can be done in code. Just not always in an easy manner. Just saying.
    Last edited by koganam; 05-11-2016, 09:19 AM. Reason: Corrected grammar.

    Comment


      #17
      Thank you Koganam for your detailed response. I appreciate you taking the time to really dive into my dilemma. I originally tried to set my exit on a separate strategy with BarOnClose=False, and then tried to call and point to that strategy from a separate Strategy with BarOnClose=true. But I understand from your first response that is not capable in Wizard. Is there any work being done to allow BarOnClose choice in each set of a Strategy editor?

      Comment


        #18
        Originally posted by CactusMo View Post
        Thank you Koganam for your detailed response. I appreciate you taking the time to really dive into my dilemma. I originally tried to set my exit on a separate strategy with BarOnClose=False, and then tried to call and point to that strategy from a separate Strategy with BarOnClose=true. But I understand from your first response that is not capable in Wizard. Is there any work being done to allow BarOnClose choice in each set of a Strategy editor?
        Subject to the understanding that it works ONLY when connected to streaming data, and hence is impossible to test in the Strategy Analyzer, it is possible to use dynamic exits on what is essentially a tick-by-tick basis, by using the OnMarketData() event handler, as the event is triggered on every tick, totally independently of BarUpdates.

        You cannot use OnMarketData() with the Wizard: you must unlock the code. Look up OnMarketData() in the NT Help.

        ref: http://ninjatrader.com/support/helpG...marketdata.htm

        Comment


          #19
          Thanks. I understand only works with live market data. Writing code is not an option for me at this point. Strategy Wizard has been very useful to those like me who are not versed in code writing. The current strategy I am working on, using Strategy analyzer, shows a 84% Profitability, Profit Factor of 27.82, Sharpe Ratio 2.53 and Max Drawdown $179.02 using one contract on ES. Backtesting done since 1Jan2016 till yesterday. So now I am testing it forward with live market data for the next few months. I believe I can improve these stats if I could use Wizard to exit OnBarClose=False when price falls below two bars ago, thereby not waiting till the bar is closed. However, I understand this is not an option for me using Wizard. Thanks for your correspondence.

          Comment


            #20
            Originally posted by CactusMo View Post
            Thanks. I understand only works with live market data. Writing code is not an option for me at this point. Strategy Wizard has been very useful to those like me who are not versed in code writing. The current strategy I am working on, using Strategy analyzer, shows a 84% Profitability, Profit Factor of 27.82, Sharpe Ratio 2.53 and Max Drawdown $179.02 using one contract on ES. Backtesting done since 1Jan2016 till yesterday. So now I am testing it forward with live market data for the next few months. I believe I can improve these stats if I could use Wizard to exit OnBarClose=False when price falls below two bars ago, thereby not waiting till the bar is closed. However, I understand this is not an option for me using Wizard. Thanks for your correspondence.
            Repeat from the earlier post: "If you want your exit order to execute when hit, it must be a sitting order, not one that is triggered dynamically. Issue an ExitLongStop() at the relevant price. A sitting Stop order is executed when hit: making the CalculateOnBarClose property irrelevant."

            That means that instead of using ExitLong(), use ExitLongStop().

            Better yet, explore the SetStopLoss() methods. They are more suited to unconditional Stop placement.
            Last edited by koganam; 05-11-2016, 10:44 AM.

            Comment


              #21
              BarOnClose

              Okay, I initiated my Exit using ExitLongStop as suggested, and compared specific backtest data for the same entry using ExitLong. Attached is the image showing price exiting using the Stop. It goes way pass my two bars below. Not confident the ExitLongStop is a better solution given this data point. Don't get me wrong. I sure do appreciate your input and advice.
              Attached Files

              Comment


                #22
                Hello,
                Can you provide a screenshot of the condition and action you have to submit the ExitLongStop()?

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

                Comment


                  #23
                  Originally posted by CactusMo View Post
                  Okay, I initiated my Exit using ExitLongStop as suggested, and compared specific backtest data for the same entry using ExitLong. Attached is the image showing price exiting using the Stop. It goes way pass my two bars below. Not confident the ExitLongStop is a better solution given this data point. Don't get me wrong. I sure do appreciate your input and advice.
                  That would just mean that the Wizard did not quite generate the code that you expected, as your logic might not have been specified rigidly enough. As I do not use the Wizard, my opinion is now useless.

                  Fortunately, NT staff are on the case, and will pick up from here and guide you on how to use the Wizard to generate the correct code. On general principle, it would appear that the Wizard should be able to generate code for your particular, somewhat simple case, even if it would not be the most efficient code.

                  Sorry that I could not be of better help.

                  Comment


                    #24
                    Thanks Koganam. I still think you are awesome. You stuck with me with patience and professionalism.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by kujista, Yesterday, 12:39 AM
                    2 responses
                    14 views
                    0 likes
                    Last Post kujista
                    by kujista
                     
                    Started by Austiner87, Yesterday, 11:24 AM
                    2 responses
                    12 views
                    0 likes
                    Last Post brucerobinson  
                    Started by Rogers101, 05-05-2024, 11:30 AM
                    3 responses
                    21 views
                    0 likes
                    Last Post Rogers101  
                    Started by nightstalker, 05-04-2024, 02:05 PM
                    5 responses
                    55 views
                    1 like
                    Last Post nightstalker  
                    Started by MSerag, Yesterday, 11:52 PM
                    0 responses
                    11 views
                    0 likes
                    Last Post MSerag
                    by MSerag
                     
                    Working...
                    X