NexusFi: Find Your Edge


Home Menu

 





Multi-timeframe code with Minute and SbSRenko


Discussion in NinjaTrader

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




 
Search this Thread

Multi-timeframe code with Minute and SbSRenko

  #1 (permalink)
 traderjh 
South Jordan UT
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Forex
Posts: 15 since Jan 2013
Thanks Given: 6
Thanks Received: 1

Hello,

I am not sure how to code both Minute frame as BarsInProcess = 0 and SBSRenko as BarsInProcess = 1 together. I also am not familiar with setting up Add(PeriodType.Custom....) for SBSRenko.

Do you have an example of code like this or is there a strategy/indicator somewhere here that I can learn from?

I appreciate your reply.

Many thanks,
-traderjh

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844


BarsInProgress, just add each one and the first one listed will be BarsInProgress == 1, second one will be BarsInProgress == 2, etc. The underlying chart data will be BarsInProgress == 0. If this doesn't make sense, search NT help file for BarsInProgress and it will show more detail.

See this thread for custom types.

Reply With Quote
Thanked by:
  #4 (permalink)
 traderjh 
South Jordan UT
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Forex
Posts: 15 since Jan 2013
Thanks Given: 6
Thanks Received: 1


vegasfoster View Post
BarsInProgress, just add each one and the first one listed will be BarsInProgress == 1, second one will be BarsInProgress == 2, etc. The underlying chart data will be BarsInProgress == 0. If this doesn't make sense, search NT help file for BarsInProgress and it will show more detail.

See this thread for custom types.


Thank you for your reply.

I coded a simple strategy to display OHLC on both Minute and SbSRenko. Minute OHLC data is showing good but SbSRenko is not showing. I added SbSRenko into Data Series and it is still not showing. What am I missing here? See code below:

 
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    [Description("")]
    public class DisplayOHLC : Strategy
    {
        #region Variables
        #endregion
        protected override void Initialize()
        {
            CalculateOnBarClose = true;
		Add(PeriodType.Minute,60);
		Add(PeriodType.Custom6,300);
        }
        protected override void OnBarUpdate()
        {
			if (BarsInProgress == 0)
			{
				DrawTextFixed("MinuteOHLC",
				"O:" + Opens[0][0]	
				+"\nH:" + Highs[0][0]
				+"\nL:" + Lows[0][0]
				+"\nC:" + Closes[0][0]
				,TextPosition.TopLeft,Color.Yellow,new Font("Arial", 9),Color.Black,Color.Black,10);
			}
			if (BarsInProgress == 1)
			{
				DrawTextFixed("RenkoOHLC",
				"O:" + Opens[0][1]
				+"\nH:" + Highs[0][1]
				+"\nL:" + Lows[0][1]
				+"\nC:" + Closes[0][1]
				,TextPosition.BottomLeft,Color.Yellow,new Font("Arial", 9),Color.Black,Color.Black,10);
			}
        }

        #region Properties
        #endregion
    }
}

Started this thread Reply With Quote
  #5 (permalink)
 traderjh 
South Jordan UT
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Forex
Posts: 15 since Jan 2013
Thanks Given: 6
Thanks Received: 1

Silly me!!

It now works! I just fixed that mistake from [0][1] to [1][0].

Thanks again!!

-traderjh

Started this thread Reply With Quote
  #6 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844

Ok, its been a while and I was thinking the minute would need to be BarsInProgress ==1 and the better renko would need to be BarsInProgress == 2, but if its working then I guess not

Reply With Quote
  #7 (permalink)
 traderjh 
South Jordan UT
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Forex
Posts: 15 since Jan 2013
Thanks Given: 6
Thanks Received: 1


vegasfoster View Post
Ok, its been a while and I was thinking the minute would need to be BarsInProgress ==1 and the better renko would need to be BarsInProgress == 2, but if its working then I guess not

It does display the values but they are not in sync with those data in Data Box window. Again, I am missing something here. :-(

Started this thread Reply With Quote
  #8 (permalink)
 vegasfoster 
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 just read the help file, and if the 60 minute data is not your base chart, then it needs to be BarsInProgress==1 and the better renko needs to be BarsInProgress==2. Other thing is a 300 better renko is a huge setting, are you sure that's the correct number?

Reply With Quote
  #9 (permalink)
 traderjh 
South Jordan UT
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Forex
Posts: 15 since Jan 2013
Thanks Given: 6
Thanks Received: 1


vegasfoster View Post
I just read the help file, and if the 60 minute data is not your base chart, then it needs to be BarsInProgress==1 and the better renko needs to be BarsInProgress==2. Other thing is a 300 better renko is a huge setting, are you sure that's the correct number?

300 better renko is actually 30 when I set the Control Center's pip quote setting to 1/10.

What I am trying to achieve is to use 60 minute chart for handling orders and to call data from better renko's open/close prices for checking the conditions. Which is more sense to use 2 Add()s for minutes and better renko in 60 minute chart like you mentioned above (1 and 2) or just one Add() with better renko in 60 min chart with BarsInProgress==0 and BarsInProgress==1?

In the code from earlier post, I was trying to retrieve live prices to make sure I coded properly but they seems not in sync with data box.

Thanks for the clarification,
-traderjh

Started this thread Reply With Quote
  #10 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844


If 60 minutes is your base chart, then I am not really sure. You can try commenting out the line "Add(PeriodType.Minute,60);" and see if it changes anything. If not, then I guess it doesn't matter and I have no other unhelpful suggestions for you try.

Reply With Quote
Thanked by:




Last Updated on July 10, 2013


© 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