NexusFi: Find Your Edge


Home Menu

 





Is MC good as a research tool?


Discussion in MultiCharts

Updated
    1. trending_up 1,656 views
    2. thumb_up 4 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 1 attachments




 
Search this Thread

Is MC good as a research tool?

  #1 (permalink)
janson
Munich
 
Posts: 10 since Jun 2010
Thanks Given: 5
Thanks Received: 3

Hi,

I am using the trial and wonder if MC is capable conducting some statistical research besides testing entry and exit strategies. For example to examine the ADR if the previous day closed at its extreme or how often some specific event occurs etc…

As far as I have worked around with MC there is no option to gather data and output them into a table and ideally process them further into some diagrammatic overview.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
38 thanks
NexusFi site changelog and issues/problem reporting
27 thanks
GFIs1 1 DAX trade per day journal
19 thanks
The Program
18 thanks
  #2 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188

In Multicharts you can write information out to an external file ie CSV for further processing by excel etc.

Regards,
Neil.

Reply With Quote
Thanked by:
  #3 (permalink)
 
bnichols's Avatar
 bnichols 
Dartmouth NS
 
Experience: Intermediate
Platform: MC, MC.Net, NT, TWS
Broker: IB / IQFeed / Kids
Trading: Forex, stocks
Posts: 637 since Feb 2010
Thanks Given: 64
Thanks Received: 460


MC is great for research whether you want to process data in real time or dump it to disk for processing by another program (for which I use either Open Office Calc or a purpose-built app witten in C# with a Windows Forms gui).

As an example of what you can do the code box below shows an indicator that calculates, displays and optionally writes to disk the so-called Hurst Exponent (a measure of how price behaviour compares to behaviour of a random process). IMO the indicator has no practical purpose other than research.

The parts of the code that control writing to disk are in bold.

The indicator itself is shown in the screenshot of 2 charts below the code box (each chart in turn showing a random entry signal applied to 2 minute AUDJPY and EURJPY spot Forex data), the aim of this particular study to determine how short time frame price movement statistics of spot currency pairs differ.

The main reason for writing the Hurst exponent data to disk was to calculate and compare probability distributions (PDFs) of the Hurst exponent itself between spot pairs in Open Office Calc, but it would be straight forward to compute the PDF in MC on the fly if desired, e.g. in order to use Chauvenet's Criterion for outlier removal--something I plan to do in the near future.

One caveat with using MC for array processing is that some of MC's array processing routines ignore the value in the first array location--a throwback to EasyLanguage's origins perhaps--so you might want to rewrite them if your indicators/signals use 0 as the first array index.

 
Code
inputs: ts1(5),ts2(10),ts3(20),plotROverS(false),plotRS(false),plotT1(false),
	plotT2(false),plotT3(false),plotHe(true),t1Color(red),t2Color(green),t3Color(blue),heColor(yellow),
	writeToDisk(false),filePath("C:\Users\Brian\Documents\")
	;
variables:
	nTs(3),
	thisMean(0),
	thisBar(0),
	thisIdx(0),
	thisSumDifference(0),
	thisMax(0),
	thisMin(0),
	thisSumDifferenceSquared(0),
	R(0),
	R1(0),
	R2(0),
	R3(0),
	S(0),
	S1(0),
	S2(0),
	S3(0),
	R1OverS1(0),
	R2OverS2(0),
	R3OverS3(0),
	t1H(0),
	t2H(0),
	t3H(0),
	logT1RS(0),
	logT2RS(0),
	logT3RS(0),
	logT1(0),
	logT2(0),
	logT3(0),
	hE(0),
	t1OK(false),
	t2OK(false),
	t3OK(false),
	nTSD(0),
       fileName("")
	
	;
Arrays:
	     t1.Array[](0),t2.Array[](0),t3.Array[](0)
	     ;
	     
once begin 
   Array_SetMaxIndex(t1.Array, ts1+1);
   Array_SetMaxIndex(t2.Array, ts2+1);
   Array_SetMaxIndex(t3.Array, ts3+1);
  fileName = filePath+getsymbolname+"_"+NumToStr(barinterval,0)+"_"+NumToStr(bartype,0)+"_"+"Hurst.csv";end;   
	
	if currentBar > ts3+1 then begin
	
		for Value1 = 1 to nTs begin
			if Value1 = 1 then begin
				Value2 = ts1;
				t1OK = false;
				for thisBar = 1 To Value2 begin
					t1.Array[thisBar-1] = Close[thisBar]-Close[thisBar-1];
				end;
				thisMean = 0;
				for thisBar = 0 To Value2-1 begin
					thisMean = thisMean + t1.Array[thisBar];
				end;
				thisMean = thisMean/Value2;
				//Print(D," ",T," t1 Mean ",thisMean:1:7);
				Value4 = 0;
				thisSumDifference = 0;
				thisSumDifferenceSquared = 0;
				for thisBar = 0 To Value2-1 begin
					//Print(" thisBar ",thisBar," of ",Value2-1);
					Value3 = t1.Array[thisBar] - thisMean;
					thisSumDifference = thisSumDifference + Value3;
					thisSumDifferenceSquared = thisSumDifferenceSquared + Value3 * Value3;
					if thisBar = 0 then begin
						thisMax = thisSumDifference;
						thisMin = thisMax;
					end
					else begin
						if thisSumDifference > thisMax then
							thisMax = thisSumDifference;
						if thisSumDifference < thisMin then
							thisMin = thisSumDifference;
					end;
					
				end;
				R = thisMax - thisMin;
				R1 = R;
				S = SquareRoot(thisSumDifferenceSquared/Value2);
				S1 = S;
				if S1 <> 0 then
					R1OverS1 = R1/S1;
				t1H = .5;
				if S <> 0 then begin
					t1OK = true;
					Value3 = R/S;
					logT1RS = Log(Value3);
					logT1 = Log(Value2);
					t1H = logT1RS/logT1;
				end;
				//Print(" t1H ",t1H);
				
			end
				
			else if Value1 = 2 then begin
				//Print(" ts2 ");
				Value2 = ts2;
				t2OK= false;
				for thisBar = 1 To Value2 begin
					t2.Array[thisBar-1] = Close[thisBar]-Close[thisBar-1];
				end;
				thisMean = 0;
				for thisBar = 0 To Value2-1 begin
					thisMean = thisMean + t2.Array[thisBar];
				end;
				thisMean = thisMean/Value2;
				//(D," ",T," t2 Mean ",thisMean:1:7);
				Value4 = 0;
				thisSumDifference = 0;
				thisSumDifferenceSquared = 0;
				for thisBar = 0 To Value2-1 begin
					//Print(" thisBar ",thisBar," of ",Value2-1);
					Value3 = t2.Array[thisBar] - thisMean;
					thisSumDifference = thisSumDifference + Value3;
					thisSumDifferenceSquared = thisSumDifferenceSquared + Value3 * Value3;
					if thisBar = 0 then begin
						thisMax = thisSumDifference;
						thisMin = thisMax;
					end
					else begin
						if thisSumDifference > thisMax then
							thisMax = thisSumDifference;
						if thisSumDifference < thisMin then
							thisMin = thisSumDifference;
					end;
					
				end;
				R = thisMax - thisMin;
				R2 = R;
				S = SquareRoot(thisSumDifferenceSquared/Value2);
				S2 = S;
				if S2 <> 0 then
					R2OverS2 = R2/S2;
				t2H = .5;
				if S <> 0 then begin
					t2OK = true;
					Value3 = R/S;
					logT2RS = Log(Value3);
					logT2 = Log(Value2);
					t2H = logT2RS/logT2;
				end;
				//Print(" t2H ",t2H);
			end
			else begin
				//Print(" ts3 ");
				Value2 = ts3;
				t3OK = false;
				for thisBar = 1 To Value2 begin
					t3.Array[thisBar-1] = Close[thisBar]-Close[thisBar-1];
				end;
				thisMean = 0;
				for thisBar = 0 To Value2-1 begin
					thisMean = thisMean + t3.Array[thisBar];
				end;
				thisMean = thisMean/Value2;
				//Print(D," ",T," t3 Mean ",thisMean:1:7);
				Value4 = 0;
				thisSumDifference = 0;
				thisSumDifferenceSquared = 0;
				for thisBar = 0 To Value2-1 begin
					//Print(" thisBar ",thisBar," of ",Value2-1);
					Value3 = t3.Array[thisBar] - thisMean;
					thisSumDifference = thisSumDifference + Value3;
					thisSumDifferenceSquared = thisSumDifferenceSquared + Value3 * Value3;
					if thisBar = 0 then begin
						thisMax = thisSumDifference;
						thisMin = thisMax;
					end
					else begin
						if thisSumDifference > thisMax then
							thisMax = thisSumDifference;
						if thisSumDifference < thisMin then
							thisMin = thisSumDifference;
					end;
					
				end;
				R = thisMax - thisMin;
				R3 = R;
				S = SquareRoot(thisSumDifferenceSquared/Value2);
				S3 = S;
				if S3 <> 0 then
					R3OverS3 = R3/S3;
				t3H = .5;
				if S <> 0 then begin
					t3OK = true;
					Value3 = R/S;
					logT3RS = Log(Value3);
					logT3 = Log(Value2);
					t3H = logT3RS/logT3;
				end;
				//Print(" t3H ",t3H);
			end;	
			
		end;

		Value1 = 0;
		nTSD = 0;
		if t1OK then begin
			nTSD = 1;
			Value1 = logT1;
			Value2 = logT1RS;
		end;
		if t2OK then begin
			nTSD = nTSD+1;
			Value1 = Value1 + logT2;
			Value2 = Value2 + logt2RS;
		end;
		if t3OK then begin
			nTSD = nTSD+1;
			Value1 = Value1 + logT3;	
			Value2 = Value2 + logt3RS;
		end;
		//Value1 = (logT1+logT2+logT3)/nTs; // xAvg
		//Value2 = (logT1RS+logT2RS+logT3RS)/nTs; // yAvg;
		value3 = 0;
		value4 = 1;
		if nTSD <> 0 then begin
			Value1 = Value1 / nTSD;
			Value2 = Value2 / nTSD;
			if t1OK then begin
				Value3 = (logT1-Value1)*(logT1RS-Value2);
				Value4 = (logT1-Value1)*(logT1-Value1);
			end;
			if t2OK then begin
				Value3 = Value3 + (logT2-Value1)*(logT2RS-Value2);
				Value4 = Value4 + (logT2-Value1)*(logT2-Value1);
			end;
			if t3OK then begin
				Value3 = Value3 + (logT3-Value1)*(logT3RS-Value2);
				Value4 = Value4 + (logT3-Value1)*(logT3-Value1);
			end;
			//Value3 = (logT1-Value1)*(logT1RS-Value2) + (logT2-Value1)*(logT2RS-Value2) + (logT3-Value1)*(logT3RS-Value2);
			//Value4 = (logT1-Value1)*(logT1-Value1) + (logT2-Value1)*(logT2-Value1) + (logT3-Value1)*(logT3-Value1);
		end;
		hE = Value3/Value4;
		
		if plotROverS then begin
			Plot1(R1OverS1,"R1OverS1");
			setPlotColor(1,t1Color);
			Plot2(R2OverS2,"R2OverS2");
			setPlotColor(2,t2Color);
			Plot3(R3OverS3,"R3OverS3");
		
		end
		else if plotRS then begin
			Plot1(R1,"R1");
			setPlotColor(1,t1Color);
			Plot2(R2,"R2");
			setPlotColor(2,t2Color);
			Plot3(R3,"R3");
			setPlotColor(3,t3Color);
			Plot4(S1,"S1");
			setPlotColor(4,t1Color);
			Plot5(S2,"S2");
			setPlotColor(5,t2Color);
			Plot6(S3,"S3");
			setPlotColor(6,t3Color);
			
		end
		else begin
			if plotT1 then begin
				Plot1(t1H,"t1H");
				setPlotColor(1,t1Color);
			end;
			if plotT2 then begin
				Plot2(t2H,"t2H");
				setPlotColor(2,t2Color);
			end;
			if plotT3 then begin
				Plot3(t3H,"t3H");
				setPlotColor(3,t3Color);
			end;
			if plotHe then begin
				Plot4(hE,"hE");
				setPlotColor(4,hEColor);
			end;
			Plot5(.5,"mid");
			setPlotColor(5,RGB(128,128,128));
		end;		
		if writeToDisk then begin
			Print(File(fileName),D:7:0,",",Time_s:6:0,",",
				NumToStr(t1H,3),",",
				NumToStr(t2H,3),",",
				NumToStr(t3H,3),",",
				NumToStr(he,3));
		end;	end;
Hurst Exponent indicator inputs, including disk directory path, highlighted by yellow box on 2 charts below


Visit my NexusFi Trade Journal Reply With Quote




Last Updated on January 7, 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