Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Display Daily SMA within Renko chart
Updated May 3, 2012
Top Posters
looks_one
foodchain
with 3 posts (0 thanks)
looks_two
Quick Summary
with 1 posts (0 thanks)
looks_3
cory
with 1 posts (1 thanks)
looks_4
vegasfoster
with 1 posts (1 thanks)
trending_up
2,397 views
thumb_up
3 thanks given
group
4 followers
forum
6 posts
attach_file
1 attachments
Display Daily SMA within Renko chart
May 2nd, 2012, 06:43 PM
san jose
Experience: Intermediate
Platform: ninjatrader, thinkorswim
Broker: IB
Trading: GC, CL, ES, ZF, ZN, DX, 6E
Posts: 22 since May 2010
Thanks Given: 12
Thanks Received: 1
The code below works fine with minutes chart that will display the daily 20 SMA with no problem.
Unfortunately, once i switch to Renko or Range chart, it's gone. Anyone can help, please.
Code
protected override void Initialize ()
{
Add ( PeriodType . Day , 1 );
Add (new Plot ( Color . FromKnownColor ( KnownColor . Orange ), PlotStyle . Line , "Plot0" ));
Overlay = true ;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate ()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
if ( CurrentBar < 30 ) return;
if ( BarsInProgress == 0 ){
Plot0 . Set ( SMA ( BarsArray [ 1 ], 20 )[ 0 ]);
}
}
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
May 2nd, 2012, 06:57 PM
virginia
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090
Attached Files
Elite Membership required to download: AddMA.cs
May 2nd, 2012, 07:06 PM
san jose
Experience: Intermediate
Platform: ninjatrader, thinkorswim
Broker: IB
Trading: GC, CL, ES, ZF, ZN, DX, 6E
Posts: 22 since May 2010
Thanks Given: 12
Thanks Received: 1
cory
Cory, your code displays the 20 SMA of the Renko bar.
What I want is to display the "DAILY 20 SMA" within a 4 Renko chart.
Thanks pal
May 2nd, 2012, 07:31 PM
las vegas
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844
I think I've done it before like
Code
protected override void Initialize()
{
Add(PeriodType.Day, 1);
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
if (CurrentBar < 30) return;
if (BarsInProgress == 0){
Plot0.Set(SimpleMA);
}
if (BarsInProgress == 1){
double SimpleMA = SMA(Closes[1],20)[0]);
}
}
It's been while though, so not sure if syntax is 100% correct or if it will make a difference even if it is, so anyone feel free to correct me, but it might be worth a try.
May 2nd, 2012, 07:49 PM
Erfurt Germany
Experience: Master
Platform: rtMagic, NinjaTrader
Broker: AMP/CQG, IAB
Trading: ES, 6E, FDAX, FGBL
Posts: 338 since Aug 2011
Thanks Given: 54
Thanks Received: 461
vegasfoster
I think I've done it before like
Code
protected override void Initialize()
{
Add(PeriodType.Day, 1);
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
private double SimpleMA=0;
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
if (CurrentBar < 30) return;
if (BarsInProgress == 0){
if(SimpleMA!=0) Plot0.Set(SimpleMA);
}
if (BarsInProgress == 1){
/*double*/ SimpleMA = SMA(Closes[1],20)[0]);
}
}
It's been while though, so not sure if syntax is 100% correct or if it will make a difference even if it is, so anyone feel free to correct me, but it might be worth a try.
-> you need for this logic a "global variable"!
May 2nd, 2012, 08:03 PM
san jose
Experience: Intermediate
Platform: ninjatrader, thinkorswim
Broker: IB
Trading: GC, CL, ES, ZF, ZN, DX, 6E
Posts: 22 since May 2010
Thanks Given: 12
Thanks Received: 1
Thanks !
Last Updated on May 2, 2012