Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy behavior in playback vs live

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

    Strategy behavior in playback vs live

    I have a strategy that, among other things, draws lines on my chart when an order is filled and enters a stop loss order. It works perfectly in playback mode drawing all of the correct lines in the correct places and entering the correct stop loss order. When in live mode, it doesn't draw any lines or enter any orders. I used Strategy Builder to create the strategy as I am not fluent in NinjaScript.

    #2
    Hello SheriDi,

    Is the strategy shown as green in the control center strategies tab when running it live? If its not placing trades that generally means the conditions to trade are not true or that it is waiting to become flat due to a historical position before entering realtime.

    Comment


      #3
      Well, it was earlier, now it's not. Need to do some more checking.

      When adding a strategy to a chart, is it normal to show trades that should have been entered previously? I want to start with a clean slate.
      Last edited by SheriDi; 05-01-2023, 09:48 AM.

      Comment


        #4
        Hello SheriDi,

        Initially you said no orders were placed but now you said an initial order was placed. Was the order that was placed a live order and what part specifically is not working after that when running it live?

        Are you referring t oa stop order that was not placed? If so how are you submitted the stop order, was that from the stops and targets page or are you using a set to submit the stop?

        Comment


          #5
          The initial order was placed, but no stop loss order and no lines were drawn on the chart as coded in the strategy. The stop order was placed via a set.

          I need to do some more checking as now when I add it, it is yellow. Will update.

          Comment


            #6
            Hello SheriDi,

            Yes in that case it sounds like the condition is just not becoming true from some reason. There are a few ways you can diagnose that, the easiest would be to use prints or drawing objects. With the strategy builder the easiest way to know why a condition is not true would be to do the following:
            1. Add a new empty set with no condition
            2. In the actions use Misc -> Print
            3. In the print dialog add any indicator values or variables that you used in the condition that is not working and then run the strategy.
            4. That will let you use the NinjaSCript output window to see what values the strategy is calculating and using to get a better idea of the problem.
            5. For price values like indicators or prices you calculate for the stop price you can also use drawing objects in that extra set to display their value constantly.

            If the strategy is listed as yellow that relates to when the initial order was placed. That means the strategy entered into a historical position and then transitioned into realtime. It would now be waiting to exit that position before working in realtime. If you don't have any exit sets then it will just remain yellow and not exit. To avoid that you can reduce the amount of historical data being used so it cannot place that trade. Alternatively you can add a condition to check the state and make sure the state is realtime to prevent it from trading historically.

            You can read about the strategies start behaviours here:



            I would also suggest to use a demo or sim account while figuring this part out just to avoid entering into positions that you need to manually close.

            Comment


              #7
              Thanks Jesse, will do.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              70 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              143 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              76 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              47 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              51 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X