Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

call an indicator (COBC) in Strategy (COET)

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

    call an indicator (COBC) in Strategy (COET)

    Hi, unfortunately i have not found a solution here. I have an indicator that is calculated on bar close (COBC):

    Code:
    public class SidiSuperTrend : Indicator
    {
    protected override void OnStateChange()
    {
     if (State == State.SetDefaults)
       {   
        Calculate = Calculate.OnBarClose;
        ....
       }
    ...
    }
    I use this indicator in my strategy which is calculated on each tick (COET)
    Code:
    public class SidiUnmanaged : Strategy
    {
     private SidiSuperTrend sidiSuperTrend;
    
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Calculate = Calculate.OnEachTick;
    ....
    }
     else if (State == State.DataLoaded)
     {
      sidiSuperTrend = SidiSuperTrend(STMode, STPeriode, STMultiplier, STMaType, STSmooth, STShowArrows, STShowHollowUpBars, STColorBars, STBarColorUp, STBarColorDown, STPlayAlert, STLongAlert, STShortAlert);
    
      if (ShowSupertrend)
      {
       AddChartIndicator(sidiSuperTrend);
      }
    }
    ...
    how can i load the indicator in the chart on calculation (COBC) and not on every tick?
    Attached Files
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Thank you for your post.

    It would not be supported to have a hosted indicator calculate on a different calculate setting, as the hosted indicator will inherit the calculate setting of the hosting script.

    Please see tips #3 and 4 on our help guide pages for Calculate:



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Hi _Kate, thanks for your quick answer. All calculations must be in the same .cs (class), where they are displayed in the chart, I have understood that ;-)
      Is there a way to start the indicator from the strategy? By this I mean that when the strategy is switched on, the indicator is also loaded, otherwise the indicator must be loaded into the chart by hand.
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        Thank you for your reply.

        Loading an indicator on a chart through a strategy is done by using AddChartIndicator within the strategy. However, as mentioned previously the hosted indicator will inherit the Calculate setting of the strategy when loaded in this way. If you just want the indicator on the chart and want it to calculate differently, you would need to manually place the indicator on the chart. The strategy would not be able to access the calculations of the manually added indicator.



        Please let us know if we may be of further assistance to you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        55 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        132 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 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