Any Multicharts .NET programmers here? - futures io
futures io futures trading



Any Multicharts .NET programmers here?


Discussion in MultiCharts

Updated by Zambi
    1. trending_up 417 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 3 replies
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

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

 
Search this Thread
 

Any Multicharts .NET programmers here?

(login for full post details)
  #1 (permalink)
Montreal
 
 
Posts: 128 since Jan 2013

Hi guys,

Just want to know if there are any Multicharts .NET programmers here?

I have a few programmers that know C# but apparently, that's not enough, you need to know how to program SPECIFICALLY for Multicharts .NET

For example this is the code that a programmer wrote in C# but it seems to work only on NinjaTrader but not on MultiCharts even though both platforms uses C#.

Anyone can help?

 
Code
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion

//This namespace holds Indicators in this folder and is required. Do not change it. 
namespace NinjaTrader.NinjaScript.Indicators
{
	public class _MW_Clouds : Indicator
	{
		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description									= @"Merlin's Clouds";
				Name										= "_MW_Clouds";
				Calculate									= Calculate.OnBarClose;
				IsOverlay									= true;
				DisplayInDataBox							= true;
				DrawOnPricePanel							= true;
				DrawHorizontalGridLines						= true;
				DrawVerticalGridLines						= true;
				PaintPriceMarkers							= true;
				ScaleJustification							= NinjaTrader.Gui.Chart.ScaleJustification.Right;
				//Disable this property if your indicator requires custom values that cumulate with each new market data event. 
				//See Help Guide for additional information.
				IsSuspendedWhileInactive					= true;

				Range1	= 6;
				Range2	= 8;
				Range3	= 10;
				Range4	= 12;
				
				ShowST = true ;
				ShowMT = true ;
				
				BandOpacity = 50 ;

				AddPlot(Brushes.Transparent, "MM1");
				AddPlot(Brushes.Transparent, "MM2");
				AddPlot(Brushes.Transparent, "MM3");
				AddPlot(Brushes.Transparent, "MM4");
			}
			else if (State == State.Configure)
			{
			}
		}

		System.Windows.Media.Brush color1 = Brushes.White ;
		System.Windows.Media.Brush color2 = Brushes.DeepSkyBlue ;
		System.Windows.Media.Brush color3 = Brushes.DimGray ;
		System.Windows.Media.Brush color4 = Brushes.Blue ;
		
		double hh1 = 0 ;
		double ll1 = 0 ;
		
		double hh2 = 0 ;
		double ll2 = 0 ;

		double hh3 = 0 ;
		double ll3 = 0 ;

		double hh4 = 0 ;
		double ll4 = 0 ;

		int sregnum = 0 ;
		int mregnum = 0 ;

		DateTime start_time1 ;
		DateTime start_time2 ;
		
		System.Windows.Media.Brush pcolor1 = Brushes.Transparent ;
		System.Windows.Media.Brush pcolor2 = Brushes.Transparent ;
		
		protected override void OnBarUpdate()
		{
			if( CurrentBar == 0 ) { start_time1 = Time[0] ; start_time2 = Time[0] ; }
			
			if( High[0] >= hh1 )			{ hh1 = High[0] ; }
			if( ll1 < ( hh1 - Range1 ))		{ ll1 = hh1 - Range1 ; }
			if( Low[0] <= ll1 )				{ ll1 = Low[0] ; }
			if( hh1 > ( ll1 + Range1 ) )	{ hh1 = ll1 + Range1 ; }
			MM1[0] = ( hh1 + ll1 ) / 2 ; ;
			
			if( High[0] >= hh2 )			{ hh2 = High[0] ; }
			if( ll2 < ( hh2 - Range2 )	)	{ ll2 = hh2 - Range2 ; }
			if( Low[0] <= ll2 )				{ ll2 = Low[0] ; }
			if( hh2 > ( ll2 + Range2 ) )	{ hh2 = ll2 + Range2 ; }
			MM2[0] = ( hh2 + ll2 ) / 2 ;

			if( High[0] >= hh3 )			{ hh3 = High[0] ; }
			if( ll3 < ( hh3 - Range3 )	)	{ ll3 = hh3 - Range3 ; }
			if( Low[0] <= ll3 )				{ ll3 = Low[0] ; }
			if( hh3 > ( ll3 + Range3 ) )	{ hh3 = ll3 + Range3 ; }
			MM3[0] = ( hh3 + ll3 ) / 2 ;

			if( High[0] >= hh4 )			{ hh4 = High[0] ; }
			if( ll4 < ( hh4 - Range4 )	)	{ ll4 = hh4 - Range4 ; }
			if( Low[0] <= ll4 )				{ ll4 = Low[0] ; }
			if( hh4 > ( ll4 + Range4 ) )	{ hh4 = ll4 + Range4 ; }
			MM4[0] = ( hh4 + ll4 ) / 2 ;

			if( CurrentBar < 5 ) { return ; }
			
			System.Windows.Media.Brush mycolor1 = MM1[0] > MM2[0] ? color1 : color2 ;
			System.Windows.Media.Brush mycolor2 = MM1[0] > MM3[0] ? color3 : color4 ;
			
			if( pcolor1 != mycolor1 )
			{
				start_time1 = Time[0] ;
				sregnum++ ;
			}
			pcolor1 = mycolor1 ;
			
			if( pcolor2 != mycolor2 )
			{
				start_time2 = Time[0] ;
				mregnum++ ;
			}
			pcolor2 = mycolor2 ;

			if( ShowST ) { Draw.Region(this,"SREG"+sregnum,start_time1,Time[0],MM1,MM2,null,mycolor1,BandOpacity); }
			if( ShowMT ) { Draw.Region(this,"MREG"+mregnum,start_time2,Time[0],MM3,MM4,null,mycolor2,BandOpacity); }
		}

		#region Properties
		[NinjaScriptProperty]
		[Range(1, int.MaxValue)]
		[Display(Name="Range1", Description="(Short term) Range1 in Points", Order=1, GroupName="Parameters")]
		public int Range1
		{ get; set; }

		[NinjaScriptProperty]
		[Range(1, int.MaxValue)]
		[Display(Name="Range2", Description="(Short term) Range2 in Points", Order=2, GroupName="Parameters")]
		public int Range2
		{ get; set; }

		[NinjaScriptProperty]
		[Range(1, int.MaxValue)]
		[Display(Name="Range3", Description="(Medium term) Range3 in Points", Order=3, GroupName="Parameters")]
		public int Range3
		{ get; set; }

		[NinjaScriptProperty]
		[Range(1, int.MaxValue)]
		[Display(Name="Range4", Description="(Medium term) Range4 in Points", Order=4, GroupName="Parameters")]
		public int Range4
		{ get; set; }

		[NinjaScriptProperty]
		[Display(Name="Show short term band", Description="Show or hide the short term band.", Order=5, GroupName="Parameters")]
		public bool ShowST
		{ get; set; }

		[NinjaScriptProperty]
		[Display(Name="Show medium term band", Description="Show or hide the medium term band.", Order=6, GroupName="Parameters")]
		public bool ShowMT
		{ get; set; }
		
		[NinjaScriptProperty]
		[Range(0, 100)]
		[Display(Name="Band opacity", Description="Band Opacity (0-100)", Order=7, GroupName="Parameters")]
		public int BandOpacity
		{ get; set; }

		[Browsable(false)]
		[XmlIgnore]
		public Series<double> MM1
		{
			get { return Values[0]; }
		}

		[Browsable(false)]
		[XmlIgnore]
		public Series<double> MM2
		{
			get { return Values[1]; }
		}

		[Browsable(false)]
		[XmlIgnore]
		public Series<double> MM3
		{
			get { return Values[2]; }
		}

		[Browsable(false)]
		[XmlIgnore]
		public Series<double> MM4
		{
			get { return Values[3]; }
		}

		#endregion

	}
}

#region NinjaScript generated code. Neither change nor remove.

namespace NinjaTrader.NinjaScript.Indicators
{
	public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
	{
		private _MW_Clouds[] cache_MW_Clouds;
		public _MW_Clouds _MW_Clouds(int range1, int range2, int range3, int range4, bool showST, bool showMT, int bandOpacity)
		{
			return _MW_Clouds(Input, range1, range2, range3, range4, showST, showMT, bandOpacity);
		}

		public _MW_Clouds _MW_Clouds(ISeries<double> input, int range1, int range2, int range3, int range4, bool showST, bool showMT, int bandOpacity)
		{
			if (cache_MW_Clouds != null)
				for (int idx = 0; idx < cache_MW_Clouds.Length; idx++)
					if (cache_MW_Clouds[idx] != null && cache_MW_Clouds[idx].Range1 == range1 && cache_MW_Clouds[idx].Range2 == range2 && cache_MW_Clouds[idx].Range3 == range3 && cache_MW_Clouds[idx].Range4 == range4 && cache_MW_Clouds[idx].ShowST == showST && cache_MW_Clouds[idx].ShowMT == showMT && cache_MW_Clouds[idx].BandOpacity == bandOpacity && cache_MW_Clouds[idx].EqualsInput(input))
						return cache_MW_Clouds[idx];
			return CacheIndicator<_MW_Clouds>(new _MW_Clouds(){ Range1 = range1, Range2 = range2, Range3 = range3, Range4 = range4, ShowST = showST, ShowMT = showMT, BandOpacity = bandOpacity }, input, ref cache_MW_Clouds);
		}
	}
}

namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{
	public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
	{
		public Indicators._MW_Clouds _MW_Clouds(int range1, int range2, int range3, int range4, bool showST, bool showMT, int bandOpacity)
		{
			return indicator._MW_Clouds(Input, range1, range2, range3, range4, showST, showMT, bandOpacity);
		}

		public Indicators._MW_Clouds _MW_Clouds(ISeries<double> input , int range1, int range2, int range3, int range4, bool showST, bool showMT, int bandOpacity)
		{
			return indicator._MW_Clouds(input, range1, range2, range3, range4, showST, showMT, bandOpacity);
		}
	}
}

namespace NinjaTrader.NinjaScript.Strategies
{
	public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
	{
		public Indicators._MW_Clouds _MW_Clouds(int range1, int range2, int range3, int range4, bool showST, bool showMT, int bandOpacity)
		{
			return indicator._MW_Clouds(Input, range1, range2, range3, range4, showST, showMT, bandOpacity);
		}

		public Indicators._MW_Clouds _MW_Clouds(ISeries<double> input , int range1, int range2, int range3, int range4, bool showST, bool showMT, int bandOpacity)
		{
			return indicator._MW_Clouds(input, range1, range2, range3, range4, showST, showMT, bandOpacity);
		}
	}
}

#endregion
Does anyone see the bug here? This is the compiling errors it gives me in the PowerLanguage Editor...



Thanks

Merlin

Reply With Quote

Can you help answer these questions
from other members on futures io?
Scan by comparing SMAs within 5 mins
ThinkOrSwim
Tradestation outside the US
TradeStation
TOS Custom Implied Volatility Rank Watchlist/Scanner Column
ThinkOrSwim
Cumulative Bid/Ask Chart resets after 2Billion
MultiCharts
TOS to NT8... Need help converting a simple indicator
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
182 thanks
Micro account vs Funded account (combine)
53 thanks
Are sharks watching on the other side?
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
24 thanks
Life sacrifice loneliness trading futures
20 thanks
 
(login for full post details)
  #2 (permalink)
Montreal
 
Experience: Intermediate
Platform: MultiCharts
Broker: IB Canada/Rithmic
Trading: CL
 
Posts: 325 since Jul 2011
Thanks: 342 given, 435 received

I don't know C# but for sure it won't work in MC when you are using NinjaTrader in the code.

 
Code
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;

Reply With Quote
 
(login for full post details)
  #3 (permalink)
Montreal
 
 
Posts: 128 since Jan 2013



olobay View Post
I don't know C# but for sure it won't work in MC when you are using NinjaTrader in the code.

 
Code
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;

he he, no shit Sherlock! I saw that the second I opened the script.

However that STILL doesn't fix it. Should I just replace NinjaTrader by Multicharts or PowerLanguage? Could it be THAT easy?

What are these "namespace" and "assembly reference" things?

Somebody will know the answer to that.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Scottsdale
 
 
Posts: 27 since Nov 2010
Thanks: 3 given, 16 received

Hi Merlin.

Converted what I could, but only as far as creating the plots (kept them in different colors). The "Draw Region" part is the most important I guess, but maybe you can give that a try. I hope this helps.

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

namespace PowerLanguage.Indicator
{
    [SameAsSymbol(true)]
	public class _MW_Clouds : IndicatorObject
	{
		public _MW_Clouds(object _ctx):base(_ctx)
		{
				Range1	= 6;
				Range2	= 8;
				Range3	= 10;
				Range4	= 12;
				
				ShowST = true ;
				ShowMT = true ;
				
				BandOpacity = 50 ;
		
		}
		/*
		protected override void OnStateChange()
		{
			if (State == State.SetDefaults)
			{
				Description									= @"Merlin's Clouds";
				Name										= "_MW_Clouds";
				Calculate									= Calculate.OnBarClose;
				IsOverlay									= true;
				DisplayInDataBox							= true;
				DrawOnPricePanel							= true;
				DrawHorizontalGridLines						= true;
				DrawVerticalGridLines						= true;
				PaintPriceMarkers							= true;
				ScaleJustification							= NinjaTrader.Gui.Chart.ScaleJustification.Right;
				//Disable this property if your indicator requires custom values that cumulate with each new market data event. 
				//See Help Guide for additional information.
				IsSuspendedWhileInactive					= true;

				Range1	= 6;
				Range2	= 8;
				Range3	= 10;
				Range4	= 12;
				
				ShowST = true ;
				ShowMT = true ;
				
				BandOpacity = 50 ;

				AddPlot(Color.Transparent, "MM1");
				AddPlot(Color.Transparent, "MM2");
				AddPlot(Color.Transparent, "MM3");
				AddPlot(Color.Transparent, "MM4");
			}
			else if (State == State.Configure)
			{
			}
		}
*/
		private IPlotObject Plot1;
		private IPlotObject MM1_plot, MM2_plot, MM3_plot, MM4_plot;
		protected override void Create()
		{
            MM1 = new VariableSeries<Double>(this);
            MM2 = new VariableSeries<Double>(this);
            MM3 = new VariableSeries<Double>(this);
            MM4 = new VariableSeries<Double>(this);
            Plot1 =
                AddPlot(new PlotAttributes("Avg", 0, Color.Yellow,
                                           Color.Empty, 0, 0, true));
			MM1_plot = AddPlot(new PlotAttributes("MM1", EPlotShapes.Line, Color.Red));
			MM2_plot = AddPlot(new PlotAttributes("MM2", EPlotShapes.Line, Color.Green));
			MM3_plot = AddPlot(new PlotAttributes("MM3", EPlotShapes.Line, Color.Blue));
			MM4_plot = AddPlot(new PlotAttributes("MM4", EPlotShapes.Line, Color.Yellow));

		
		}
		protected override void StartCalc() {
			// assign inputs 
		}
		
		Color color1 = Color.White ;
		Color color2 = Color.DeepSkyBlue ;
		Color color3 = Color.DimGray ;
		Color color4 = Color.Blue ;
		
		double hh1 = 0 ;
		double ll1 = 0 ;
		
		double hh2 = 0 ;
		double ll2 = 0 ;

		double hh3 = 0 ;
		double ll3 = 0 ;

		double hh4 = 0 ;
		double ll4 = 0 ;

		int sregnum = 0 ;
		int mregnum = 0 ;

		DateTime start_time1 ;
		DateTime start_time2 ;
		
		Color pcolor1 = Color.Transparent ;
		Color pcolor2 = Color.Transparent ;
		
		protected override void CalcBar()
		{
			if( Bars.CurrentBar == 0 ) { start_time1 = Bars.Time[0] ; start_time2 = Bars.Time[0] ; }
			
			if( Bars.High[0] >= hh1 )			{ hh1 = Bars.High[0] ; }
			if( ll1 < ( hh1 - Range1 ))		{ ll1 = hh1 - Range1 ; }
			if( Bars.Low[0] <= ll1 )				{ ll1 = Bars.Low[0] ; }
			if( hh1 > ( ll1 + Range1 ) )	{ hh1 = ll1 + Range1 ; }
			MM1.Value = ( hh1 + ll1 ) / 2 ; 
			MM1_plot.Set(0, MM1.Value);
			
			if( Bars.High[0] >= hh2 )			{ hh2 = Bars.High[0] ; }
			if( ll2 < ( hh2 - Range2 )	)	{ ll2 = hh2 - Range2 ; }
			if( Bars.Low[0] <= ll2 )				{ ll2 = Bars.Low[0] ; }
			if( hh2 > ( ll2 + Range2 ) )	{ hh2 = ll2 + Range2 ; }
			MM2.Value = ( hh2 + ll2 ) / 2 ;
			MM2_plot.Set(0, MM2[0]);
			
			if( Bars.High[0] >= hh3 )			{ hh3 = Bars.High[0] ; }
			if( ll3 < ( hh3 - Range3 )	)	{ ll3 = hh3 - Range3 ; }
			if( Bars.Low[0] <= ll3 )				{ ll3 = Bars.Low[0] ; }
			if( hh3 > ( ll3 + Range3 ) )	{ hh3 = ll3 + Range3 ; }
			MM3.Value = ( hh3 + ll3 ) / 2 ;
			MM3_plot.Set(0, MM3[0]);

			if( Bars.High[0] >= hh4 )			{ hh4 = Bars.High[0] ; }
			if( ll4 < ( hh4 - Range4 )	)	{ ll4 = hh4 - Range4 ; }
			if( Bars.Low[0] <= ll4 )				{ ll4 = Bars.Low[0] ; }
			if( hh4 > ( ll4 + Range4 ) )	{ hh4 = ll4 + Range4 ; }
			MM4.Value = ( hh4 + ll4 ) / 2 ;
			MM4_plot.Set(0, MM4[0]);

			if( Bars.CurrentBar < 5 ) { return ; }
			
			Color mycolor1 = MM1[0] > MM2[0] ? color1 : color2 ;
			Color mycolor2 = MM1[0] > MM3[0] ? color3 : color4 ;
			
			if( pcolor1 != mycolor1 )
			{
				start_time1 = Bars.Time[0] ;
				sregnum++ ;
			}
			pcolor1 = mycolor1 ;
			
			if( pcolor2 != mycolor2 )
			{
				start_time2 = Bars.Time[0] ;
				mregnum++ ;
			}
			pcolor2 = mycolor2 ;

			//if( ShowST ) { Draw.Region(this,"SREG"+sregnum,start_time1,Time[0],MM1,MM2,null,mycolor1,BandOpacity); }
			//if( ShowMT ) { Draw.Region(this,"MREG"+mregnum,start_time2,Time[0],MM3,MM4,null,mycolor2,BandOpacity); }
		}

		#region Properties
		//[NinjaScriptProperty]
		[Input]
		//[Range(1, int.MaxValue)]
		//[Display(Name="Range1", Description="(Short term) Range1 in Points", Order=1, GroupName="Parameters")]
		public int Range1
		{ get; set; }

		//[NinjaScriptProperty]
		[Input]
		//[Range(1, int.MaxValue)]
		//[Display(Name="Range2", Description="(Short term) Range2 in Points", Order=2, GroupName="Parameters")]
		public int Range2
		{ get; set; }

		//[NinjaScriptProperty]
		[Input]
		//[Range(1, int.MaxValue)]
		//[Display(Name="Range3", Description="(Medium term) Range3 in Points", Order=3, GroupName="Parameters")]
		public int Range3
		{ get; set; }

		//[NinjaScriptProperty]
		[Input]
		//[Range(1, int.MaxValue)]
		//[Display(Name="Range4", Description="(Medium term) Range4 in Points", Order=4, GroupName="Parameters")]
		public int Range4
		{ get; set; }

		//[NinjaScriptProperty]
		[Input]
		//[Display(Name="Show short term band", Description="Show or hide the short term band.", Order=5, GroupName="Parameters")]
		public bool ShowST
		{ get; set; }

		//[NinjaScriptProperty]
		[Input]
		//[Display(Name="Show medium term band", Description="Show or hide the medium term band.", Order=6, GroupName="Parameters")]
		public bool ShowMT
		{ get; set; }
		
		//[NinjaScriptProperty]
		[Input]
		//[Range(0, 100)]
		//[Display(Name="Band opacity", Description="Band Opacity (0-100)", Order=7, GroupName="Parameters")]
		public int BandOpacity
		{ get; set; }

		//[Browsable(false)]
		//[XmlIgnore]
		public VariableSeries<double> MM1
		{
			get; set;//get { return Values[0]; }
		}

		//[Browsable(false)]
		//[XmlIgnore]
		public VariableSeries<double> MM2
		{
			get; set;//get { return Values[1]; }
		}

		//[Browsable(false)]
		//[XmlIgnore]
		public VariableSeries<double> MM3
		{
			get; set;//get { return Values[2]; }
		}

		//[Browsable(false)]
		//[XmlIgnore]
		public VariableSeries<double> MM4
		{
			get; set;//get { return Values[3]; }
		}

		#endregion

	}
}

Reply With Quote


futures io Trading Community Platforms and Indicators MultiCharts > Any Multicharts .NET programmers here?


August 22, 2019


Upcoming Webinars and Events
 

Relative Rotation Graphs w/Julius de Kempenaer

Elite only
 

Every journal equals ten meals for the hungry

Now
     



Copyright © 2020 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