NexusFi: Find Your Edge


Home Menu

 





V8 time based indicator on a non-time-based chart, e.g., Renko, volume, tick


Discussion in NinjaTrader

Updated
    1. trending_up 911 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

V8 time based indicator on a non-time-based chart, e.g., Renko, volume, tick

  #1 (permalink)
 bulldog 
Salt Lake City, UT
 
Experience: Beginner
Platform: NT
Trading: 6E
Posts: 4 since Aug 2012
Thanks Given: 0
Thanks Received: 0

Would someone kindly provide a bit of code that would plot the 1 minute SMA on a Renko, volume, tick or some other non-time based chart?

I don't understand how to connect the AddDataSeries, AddPlot and the Values array.

Here's what I have:

public class b8MovingAverage : Indicator
{
private double priorSum;
private double sum;

protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Plot moving average based on a minut period";
Name = "b8MovingAverage";
IsOverlay = true;
IsSuspendedWhileInactive = true;
Period = 200;

}
else if (State == State.Configure)
{
priorSum = 0;
sum = 0;

AddDataSeries(BarsPeriodType.Minute, Period);
AddPlot(Brushes.Red, "b8MovingAverage");
}
}

protected override void OnBarUpdate()
{
Value[0] = SMA(Closes[1][0], Period)[0];
}

#region Properties
[Range(1, int.MaxValue), NinjaScriptProperty]
[Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
public int Period
{ get; set; }
#endregion
}
}

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
 
  #2 (permalink)
 Seberbach 
Midland, Michigan USA
 
Experience: Advanced
Platform: TradeStation, Biocomp
Trading: TF
Posts: 21 since Aug 2010
Thanks Given: 71
Thanks Received: 22

Bulldog,

I am not a Ninja programmer, but I think this topic is very interesting and might be very useful when plotted with any language/trading platform. So my view on this in plain English...I would first think of this as showing ANY price indicator in real time or recorded after any definable event in the x-axis scale your BARS are plotted in. That leads to plotting your indicator recorded in another x-axis scale once it is defined as set-in-stone in the bar plot x-axis scale array.

So I would plot at least both x-axis scales' real time value as they are shown in real time in your time interval-based input data array such as ticks, seconds, thus defined, and the value of the one minute SMA upon the BAR CLOSED event, where it could be placed in an array of O,H,L,C,new indicator, upon bar close, or in a separate array of indicators set and plotted upon bar close. That could be, say, high and low of indicator saved on most recent high and low of plotted Renko, range,volume, etc. bar.

If you are watching a chart in real time, it makes sense to be able to see what is happening on one x-axis scale when a significant event is shown on a different x-axis scale.

Thus, it could be possible to make your template code able to show anything you want as it happens in any x-axis "time passed or events finished, or new non-time-interval based event occurred, etc.

What you are showing with your "any x-axis scale event indicator" plotting is the most recent event you can define with the same dimensions shown as your bar plot array, and they become fixed in your "saved-bars-plotted" array when the basic "bars plotted" array close event is done, its value is set, and the new bar plot is opened in real time.

Reply With Quote
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


@bulldog: no coding needed, just add another dataseries in the chart and an SMA on this secondary dataserie.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on April 3, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts