• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

disabling strategy after closed trade

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

  • NinjaTrader_PaulH
    replied
    Hello sra18376,

    Thanks for your post.

    You can disable the strategy with the Disable() method, please see: https://ninjatrader.com/support/help...7/?disable.htm

    You can "skip" historical trades by adding: if (Historical) return; at the top of OnBarUpdate(), this will prevent code below that line from processing until connected to live data.

    Reference: https://ninjatrader.com/support/help...historical.htm

    Leave a comment:


  • sra18376
    started a topic disabling strategy after closed trade

    disabling strategy after closed trade

    I am building a strategy and would like for it to automatically 'disable' after a trade is closed.

    essentially, i would like to have it set up where i pick a stock, start the strategy on it (starting the strategy immediately opens a long or short), and then when the parameters are met to close the trade, the trade is closed and the strategy stops.

    I have achieved this thus far by having a bool flip on when i exit a long or short that prevents me from automatically entering another trade.

    However when testing applying the strategy on a chart, it never stays enabled because the strategy starts on past candles on the chart instead of the current one and closes the trade before the current candle starts. this causes the bool to flip on before my current trade is able to even play out.

    Is there a better way to achieve what i am trying to do? Or, is there a way to have the strategy not be applied to any of the prior data in a chart?

Latest Posts

Collapse

Topics Statistics Last Post
Started by Teebone21, Yesterday, 04:26 PM
1 response
7 views
0 likes
Last Post NinjaTrader_ChrisL  
Started by MrSomebody, Today, 06:46 AM
1 response
11 views
0 likes
Last Post MojoJojo  
Started by catinabag, Today, 06:09 AM
0 responses
3 views
0 likes
Last Post catinabag  
Started by Fiocco, Today, 05:59 AM
0 responses
10 views
0 likes
Last Post Fiocco
by Fiocco
 
Started by Perceivedshift, Today, 05:17 AM
0 responses
15 views
0 likes
Last Post Perceivedshift  
Working...
X