Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

semi automatic trading script

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

    semi automatic trading script

    Hello,

    I'm coding a strategy just to manage positions. I will open this only when I want to enter to market, and close when this exit the positions. The problem is that when I open the strategy on chart, this initially try to operate the past data of the chart and make a sort of historic run. This is not desired, because this change some variables that I need with initialized values at the beginning of the script.

    In resume, I would like to know if I can avoid this historical run of the strategy, so the strategy start to run just with the current data, the data which is in the current bar as I open the strategy, it should be the start bar, not to try to run on past bars.

    Thanks

    #2
    Hello federicoo,

    Thanks for your post.

    Yes, you can skip processing the historical bars by adding this in your onBarUpdate():

    if (State == State.Historical) return; // return if not real time.

    Reference: https://ninjatrader.com/support/help...nt8/?state.htm

    Comment


      #3
      Thank you Paul, it works fine!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      72 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X