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 performance in builder

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

    Strategy performance in builder

    Hey all new problem.

    I am using the strategy builder as always. lol

    I have a sample strat that uses the SystemPerformanceAllTrades.TradePerformancePoints. CumProfit<75

    Basically I want to stop trading after 75 points or a certain dollar amount are made total for the day.

    This works in backtesting however it takes no trades live.

    Any ideas why, or how this can be accomplished in the builder.

    Included SS just in case.


    Click image for larger version

Name:	2022-09-30 10_05_19-Strategy Builder.png
Views:	152
Size:	4.4 KB
ID:	1217603


    #2
    Hello sprks7979,

    You can find a sample that shows how to use trade performance in the builder. You need to do some math to find out the current performance because it does not normally reset per session.


    hi, hoping to find a method in nj8 strategy builder whereby i could set an overall loss limit on a strategy. in other words to have it exit positions and turn off the working strategy, thanks
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for the script. I did have a question and a concern. I have my strat that has multiple set. Ie.

      Set 1 - if MACD Diff is < 0 AND IsFirstTickOfBar = true Then enter Long
      Set 2 - If MACD Diff is 0 then ExitLong
      Set 3 - this is where i have the systemperformance set
      Set 4 - if MACD Diff is > 0 AND IsFirstTickOfBar = true Then enter Long
      Set 5 - If MACD Diff is 0 then ExitLong​


      Would the System performance set need to come after both the buy and sell sets? or just at the end of the sets?

      My issue is that i have not been able to get it to take a "live" trade but it works in backtest.

      Question 2 -
      I get this message in the output

      "9/30/2022 12:55:36 PM Strategy 'ExampleFlipFlop2mini750max2/274491531': Entered internal SubmitOrderManaged() method at 9/30/2022 12:55:36 PM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
      9/30/2022 12:55:36 PM Strategy 'ExampleFlipFlop2mini750max2/274491531': Ignored SubmitOrderManaged() method at 9/30/2022 12:55:36 PM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'​"
      Last edited by sprks7979; 09-30-2022, 11:08 AM.

      Comment


        #4
        Hello sprks7979,

        You would want any sets that use the system performance to come after the first few sets which configure the variables. In that sample it has a two sets of conditions that come after the first few sets that control entry orders. The same would apply in your script, the initial few sets can be used to configure the variables in the same way as that sample then any other conditions could come after those sets so you can use the values.

        The ignored message you are getting is because one of your exit conditions is becoming true when there is no position to exit. You can add additional conditions to your exit sets which check the strategies market position. If it is long then exit long, if it is short then exit short.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Ok, so I think I may have it figured out but an running into another issue. I am wanting trades to take place at the open of the bar following the signal. I am currently using IsFirstTickOfBar and while using backtest it works fine. However when running live sim it will open trades in the middle of a bar. Does it matter what kind of bar it is? Ie. Will work on minutes but not renko? Thanks

          Comment


            #6
            Hello sprks7979,

            IsFirstTickOfBar is always true during historical tests because historical tests use OnBarClose processing. If you see that using OnBarClose processing works better you could use that in realtime as well. IsFirstTickOfBar being used for an entry could result in the price being anywhere around the open of that bar if you had used a market order.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Thanks, that seems logical. Another question when you have time. In the backtest I use standard fill resolution and it works out ok. Should I be using High resolution. I am using 40 tick renko bars in my test. My concern is that most of my strats come out somewhat positive with standard fill but with high fill resolution not one strat is positive. When is it necessary to use high fill vs standard.
              Thanks

              Comment


                #8
                Hello sprks7979,

                It is suggested to move to using the playback connection if you are using renko bars. Renko bars in historical behave differently than they do in realtime due to how they are modified. Historical bars have no granularity like realtime bars do so the renko logic is not fully used in historical. Using playback you could get a more accurate representation of how the bars will actually build so you can test the strategy more accurately.

                High fill resolution sets a secondary series to be used only for fills. That means instead of using the bar close times for the fill logic it would use a 1 tick or whatever series you selected to check for fills which can be more accurate. This requires additional data which makes the test require more data. Its not necessary but can be used if you would like to see more granular fills.

                JesseNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by helpwanted, Today, 03:06 AM
                2 responses
                21 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by DayTradingDEMON, Today, 09:28 AM
                0 responses
                1 view
                0 likes
                Last Post DayTradingDEMON  
                Started by navyguy06, Today, 09:28 AM
                0 responses
                2 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
                 
                Started by cmtjoancolmenero, Yesterday, 03:58 PM
                7 responses
                31 views
                0 likes
                Last Post cmtjoancolmenero  
                Working...
                X