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

Strategy Waiting For Flat Position

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

    Strategy Waiting For Flat Position

    ​I have a strategy that on occasion starts as "waiting for flat" status in orange (see pic below). The strategy accepts an "override" price argument that if is set will go place a trade if the market is within a couple points from the market price. From my testing it works fine as long as you pick an override price far away from where the market is/was at. I think the strategy is looking back and because the market price was recently my override price it assumes that the strategy is in a position when in fact I'm not.

    So in the below example, the DOW was at 28440 but that was a day ago. Today it is at 28582 (which does not meet my requirement for a trade).



    Click image for larger version

Name:	strategy-waiting-for-flat.PNG
Views:	252
Size:	9.1 KB
ID:	1122258
    Attached Files

    #2
    Hello bc24fl,

    The wait until flat start behavior relies on how your strategy processes historical data. It sounds like you have added an input to help mitigate trading up to transitioning in realtime to avoid this, that is one possible way to get it to start immediately assuming it does not equate to having a position.

    If the strategy in any situation equates to having a position in historical data you will see this happen.

    You may be able to use a different start behavior if there is one that more closely matches your goals, you can read about each here: https://ninjatrader.com/support/help...hlightsub=sync

    Another alternative is to not trade in historical if this is a realtime only strategy. You can just use if(State == State.Realtime) surrounding any order logic.


    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello bc24fl,

      The wait until flat start behavior relies on how your strategy processes historical data. It sounds like you have added an input to help mitigate trading up to transitioning in realtime to avoid this, that is one possible way to get it to start immediately assuming it does not equate to having a position.

      If the strategy in any situation equates to having a position in historical data you will see this happen.

      You may be able to use a different start behavior if there is one that more closely matches your goals, you can read about each here: https://ninjatrader.com/support/help...hlightsub=sync

      Another alternative is to not trade in historical if this is a realtime only strategy. You can just use if(State == State.Realtime) surrounding any order logic.


      I look forward to being of further assistance.
      I read that section of the help guide but not sure what option to select. If I select "Immediate Submit" it will place a trade even though currently the market price does not meet my criteria. I can try the (State == State.Realtime) but then I have to disable this option to test it in market replay.

      Comment


        #4
        Hello bc24fl,

        If none of the start behaviors match the way you want to use the script you may need to look at using other means like logic. you could also use a user input to control allowing trading instead of using Realtime, that really depends on how you overall need to use the script. As a side note he Realtime condition would work in Playback but would not in historical modes like backtesting.

        Please let me know if I may be of additional assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by patrickmlee007, Today, 09:33 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
        53 responses
        5,305 views
        0 likes
        Last Post BartMan
        by BartMan
         
        Started by Richozzy38, Today, 01:06 PM
        2 responses
        12 views
        0 likes
        Last Post Richozzy38  
        Started by Lele2k24, Today, 01:32 PM
        4 responses
        10 views
        0 likes
        Last Post Lele2k24  
        Started by Sebastian - TwinPeaks, Today, 01:31 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Working...
        X