Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Why Multi-timeframe Plots are useless on Ninjatrader...

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

    Why Multi-timeframe Plots are useless on Ninjatrader...

    You need to draw a trendline of the plot, or you miss the bus.

    I've literally spent hours trying to solve this. Why can't secondary data series plot OnEachTick?

    I'm really annoyed I missed that move.
    Attached Files

    #2
    Hello reach4thelasers,

    Thanks for opening the thread.

    I am able to have an indicator that operates on a separate data series update its plots with each incoming tick when I use Calculate.OnEachTick. I am adding a plot to the calling NinjaScript that has Calculate.OnEachTick set, and I am updating the Value it uses within OnBarUpdate() for the BarsInProgress of that data series. Each additional data series is being calculated for each tick.

    Here is some sample code describing what I am doing.

    Code:
    else if (State == State.Configure)
    	{				
    		AddDataSeries(Instrument.FullName, BarsPeriod);
    		AddPlot(Brushes.Red, "MyPlot");
    	}
    	else if (State == State.DataLoaded)
    	{
    		myIndicator = Indicator(BarsArray[1]);
    	}				
    }
    
    protected override void OnBarUpdate()
    {
    	if(CurrentBars[0] < 1 || CurrentBars[1] < 1) return;
    	
    	if (BarsInProgress == 1)
    	{
    		Values[0][0] = myIndicator.Value[0];
    	}	
    }
    Single Tick data series' can be used for intra bar granularity for historical data, and can be used to update the plots per tick as well.

    Please let me know if I may be of further assistance.

    Comment


      #3
      Hey Jim,

      I replicated your code exactly and tried to use it with the EMA indicator. What am I doing wrong here? It doesn't seem to do anything...

      Cheers,,

      Kev


      Originally posted by NinjaTrader_Jim View Post
      Hello reach4thelasers,

      Thanks for opening the thread.

      I am able to have an indicator that operates on a separate data series update its plots with each incoming tick when I use Calculate.OnEachTick. I am adding a plot to the calling NinjaScript that has Calculate.OnEachTick set, and I am updating the Value it uses within OnBarUpdate() for the BarsInProgress of that data series. Each additional data series is being calculated for each tick.

      Here is some sample code describing what I am doing.

      Code:
      else if (State == State.Configure)
      	{				
      		AddDataSeries(Instrument.FullName, BarsPeriod);
      		AddPlot(Brushes.Red, "MyPlot");
      	}
      	else if (State == State.DataLoaded)
      	{
      		myIndicator = Indicator(BarsArray[1]);
      	}				
      }
      
      protected override void OnBarUpdate()
      {
      	if(CurrentBars[0] < 1 || CurrentBars[1] < 1) return;
      	
      	if (BarsInProgress == 1)
      	{
      		Values[0][0] = myIndicator.Value[0];
      	}	
      }
      Single Tick data series' can be used for intra bar granularity for historical data, and can be used to update the plots per tick as well.

      Please let me know if I may be of further assistance.
      Attached Files
      Last edited by reach4thelasers; 05-19-2017, 12:18 PM.

      Comment


        #4
        Hello Kevin,

        Thanks for writing back.

        Perhaps I misunderstood your question. When I test your sample indicator, I am seeing the EMA's plot updating with each tick, before the close of the current bar.

        I've attached a couple screenshots depicting the plot updating after each tick when connected to the simulated data feed.

        If I am missing the boat here, could you provide me a bit more detail as to what you are trying to accomplish?

        I look forward to being of further help.
        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        162 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        81 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        125 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        206 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        184 views
        0 likes
        Last Post CarlTrading  
        Working...
        X