MaxBarsBack in Signal problem - MultiCharts | futures io social day trading
futures io futures trading


MaxBarsBack in Signal problem
Updated: Views / Replies:783 / 3
Created: by Jeffrey Attachments:2

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

MaxBarsBack in Signal problem

  #1 (permalink)
Elite Member
Hong Kong
 
Futures Experience: Beginner
Platform: MultiCharts, NinjaTrader
Favorite Futures: HSIF, ES
 
Posts: 10 since Jul 2010
Thanks: 2 given, 1 received

MaxBarsBack in Signal problem

I tried to code some very simple signal using my own indicator as below:

 
Code
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;

namespace PowerLanguage.Strategy {
	public class Jeffrey_SimpleHMADailyLE : SignalObject {
		public Jeffrey_SimpleHMADailyLE(object _ctx):base(_ctx){}
		
		private int _Period;

		[Input]	
        public int Period
        {
            get { return this._Period; }
            set { 
				
				if (value<2) {
					this._Period = 2;
				} else {
					this._Period = value; 
				}			
			}
        }			
		
		private IOrderMarket buy_order;
		private IOrderMarket sell_order;	
		
		private PowerLanguage.Indicator.Jeffrey_ATR_v2 atr;
		
		private PowerLanguage.Indicator.Jeffrey_HMA hma;		
		
		protected override void Create() {
			// create variable objects, function objects, order objects etc.

			// create variable objects, function objects, order objects etc.
			buy_order = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, EOrderAction.Buy));
			sell_order = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, EOrderAction.Sell));

			/*
			atr = (PowerLanguage.Indicator.Jeffrey_ATR_v2)AddIndicator("Jeffrey_ATR_v2");
			atr.Mode=1;
			atr.Period=Period;
			*/
			
			
			hma = (PowerLanguage.Indicator.Jeffrey_HMA)AddIndicator("Jeffrey_HMA");
			hma.Period=Period;
			
			
		}
		protected override void StartCalc() {
			// assign inputs 
			
			#if DEBUG							
				Output.Clear();
				Output.WriteLine("{0} StartCalc()", this.GetType().ToString());			
				Output.WriteLine("[{0}] CurrentBar={1} CurrentBarAbsolute+1={2} MaxBarsBack={3} Period={4} Close[0]={5}",
				Bars.Time[0].ToString("yyyy/MM/dd HH:mm:ss"),			
	            Bars.CurrentBar,
				Bars.CurrentBarAbsolute()+1,
	            ExecInfo.MaxBarsBack,
				Period,
				Bars.Close[0]);
			#endif				
			

			
			#if DEBUG						
				Output.WriteLine("StartCalc()");			
				Output.WriteLine("");
			#endif				
		}
		protected override void CalcBar(){
			// strategy logic 

			
			#if DEBUG			
				Output.WriteLine("CalcBar()");
				Output.WriteLine("[{0}] CurrentBar={1} CurrentBarAbsolute+1={2}",
				Bars.Time[0].ToString("yyyy/MM/dd HH:mm:ss"),
				Bars.CurrentBar, 				
				Bars.CurrentBarAbsolute()+1);			
			#endif			
						
			bool entryCondition1 = hma.Plots[0].Values[0] > hma.Plots[0].Values[1];
			bool exitCondition1 = hma.Plots[0].Values[0] < hma.Plots[0].Values[1];

			
			if (entryCondition1) {
				buy_order.Send();								
			}

			if (exitCondition1) {
				sell_order.Send();								
			}
			
			#if DEBUG					
				Output.WriteLine("CalcBar()");
				Output.WriteLine("");
			#endif					
			
		}
	}
}
I have set the period to 10 and maxbarsSetting in the properties to 500. However I still get the error saying I am referencing the bars outside the range.

It is totally fine if I use my own HMA indicator as study since I will set the period to 2 as minimum programmatically. Not sure why it become so trouble when it is referenced inside a strategy.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #2 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received

I saw you also posted this on the MultiCharts forum. Can you update whether it's solved for you now?

It would be a shame if people on futures.io (formerly BMT) invest time in trying to solve this problem when it's already solved.

Reply With Quote
 
  #3 (permalink)
Elite Member
Hong Kong
 
Futures Experience: Beginner
Platform: MultiCharts, NinjaTrader
Favorite Futures: HSIF, ES
 
Posts: 10 since Jul 2010
Thanks: 2 given, 1 received


No...No reply from MC support right now.

Reply With Quote
 
  #4 (permalink)
Elite Member
Hong Kong
 
Futures Experience: Beginner
Platform: MultiCharts, NinjaTrader
Favorite Futures: HSIF, ES
 
Posts: 10 since Jul 2010
Thanks: 2 given, 1 received


Jeffrey View Post
No...No reply from MC support right now.


Solved. If the signal is calling an indicator with MaxBarSetting coded programmatically, it will throw error.

I think the reason is MC allows user to set the MaxBarSetting in the signal's properties tab, and the value can't override the one inside the indicator.

Strange design thru, the MaxBarSetting shouldn't be set programmatically unless you will never use it inside a signal.

Reply With Quote

Reply



futures io > > > > MaxBarsBack in Signal problem

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
N Bars Before And After Signal Cachevary NinjaTrader Programming 3 January 22nd, 2015 07:19 PM
counter bar from one signal bergimax NinjaTrader Programming 4 January 11th, 2014 03:11 AM
Exit Signal Help jordis NinjaTrader Programming 3 December 20th, 2012 06:30 PM
Signal service freddy250 Trading Reviews and Vendors 2 December 18th, 2012 07:11 PM
BEST BEST Entry Signal dimitri The Elite Circle 11 January 28th, 2011 07:47 AM


All times are GMT -4. The time now is 06:06 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-18 in 0.09 seconds with 21 queries on phoenix via your IP 54.221.93.187