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

Help mod indicator

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

    Help mod indicator

    Hi, i have a supertrend ive downloaded from one of the threads, i would like to make it lag, meaning recalculate 1 bar behind the open bar, like when its set to calculate on bar close, but working real-time.

    ive tried many times but gets broken no idea what im doing wrong, thanks very much in advance!

    The idea is to get the indicator to calculate on bar close, while the strategy calculates in realtime so it fills the orders realtime instead of waiting for the close of the candle
    Last edited by kabott; 10-06-2015, 07:49 AM.

    #2
    Hello kabott,

    Thanks for your post.

    A couple of alternatives are:

    1) Add a 1 tick data series to your strategy and run it CalculateOnBarClose = true with your strategy logic pointing to the 1 tick series while the indicator runs off the primary bars. This will give your strategy logic an OnBarUpdate for each tic to process the orders while pointing to the previous bar in the indicator.

    2) In your strategy, evaluate the indicator on bar index [1] instead of [0] (where 1 is the just completed bar and [0] is the bar forming, when CalculateOnbarClose = false.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul, thanks for your response, i was going for the second alternative but the indicator seemed to brake every time, i tested several alternatives until it finally worked ok, now a new problem has emerged, i have this logic:

      //FALLING TREND
      if ( ( Close[1] < _superTrend.SPFlipper[1] )
      && ( Close[1] > _superTrend.SPCenterAverage[1] || Close[2] > _superTrend.SPCenterAverage[2] )
      && ( Close[3] > Open[3] && Close[2] > Open[2] && Close[1] < Open[1] && FirstTickOfBar ) )

      SELL

      With the intention once the conditions are met, the strategy should sell at the open of the second bearish renko bar

      Click image for larger version

Name:	2015-10-06_134748.jpg
Views:	1
Size:	7.6 KB
ID:	874890

      yet, it seems to be selling when ever it pleases, sometimes even at the third bearish bar

      EDIT: ok i think i fixed it now.
      Last edited by kabott; 10-06-2015, 11:29 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mizzouman1, Today, 07:35 AM
      0 responses
      2 views
      0 likes
      Last Post Mizzouman1  
      Started by i019945nj, 12-14-2023, 06:41 AM
      6 responses
      66 views
      0 likes
      Last Post i019945nj  
      Started by aa731, Today, 02:54 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by BarzTrading, Today, 07:25 AM
      0 responses
      3 views
      0 likes
      Last Post BarzTrading  
      Started by ruudawakening, Today, 12:58 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X