Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 04-20-2009, 05:44 PM   #1

Join Date: Jan 2008
Location: San Francisco
Posts: 394
Ignore this user

Thanks: 17
Thanked 338 Times in 156 Posts

Rotation Factor (Market Profile Code)

this EasyLanguage code for 'Rotation Factor' (a Market Profile indicator) was working fine but somehow got screwed up in a Open Ecry software upgrade.

I have a headache trying to fix it because it seems to have logic that is perfectly fine. Can someone take a look at this and figure out how to re-write it in a different way that might make it work? I am thinking there is something wrong with either the word 'summation' or with the 'length' code....

What its supposed to do is track 30-min bars relative to the one preceeding it and keep a 'running score' --- such that if a low goes below the previous low, that is -1 -- if the high makes a lower high, that is -1 for a total score of -2 for that bar. these are then summed for the intraday session since the beginning of the day (you don't score the first bar of day fyi). so a rotation factor of -4 would be a day where you have made 2 lower lows and 2 lower highs after the first THREE bars. inside bars (ie, high<high[1] AND low>low[2]) and outside bars are scored as a zero.

again, this WAS working but no longer does so what I need is for the same content to work --- but somehow coded differently in the hopes that OEC will be able to read the re-worked code.

thanks in advance:

vars: aa(0), bb(0), cc(0), dd(0), ee(0), firstbar(0), length(0);
if date>date[1] then begin
firstbar=currentbar;
end;

length=(currentbar-firstbar);


if h>h[1] then aa=1 else aa=0;
if h<h[1] then bb=-1 else bb=0;
if h=h[1] then cc=0;

if l>l[1] then dd=1 else dd=0;
if l<l[1] then ee=-1 else ee=0;
if l=l[1] then cc=0;

value1=aa+bb+cc+dd+ee;
if date = date[1] then value2=summation(value1,l ength);

if date = date[1] then begin
plot1(value2,"count1");
end;

plot2(0,"0");
Frank is offline  
Reply With Quote
Old 04-20-2009, 05:55 PM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Rotation Factor (Market Profile Code)

what seems to be your problem?

can you post the error message?

The code compiled in MultiCharts.
Here's the chart. Does it looks right?

p.s. I have added the up/down color.


Attached Thumbnails
Rotation Factor (Market Profile Code)-rotation_factor.jpg  

Last edited by Tams; 04-20-2009 at 06:23 PM.
Tams is offline  
Reply With Quote
Old 04-20-2009, 06:22 PM   #3

Join Date: Jan 2008
Location: San Francisco
Posts: 394
Ignore this user

Thanks: 17
Thanked 338 Times in 156 Posts

Re: Rotation Factor (Market Profile Code)

thx tams,

it compiles without an error -- it just gives the wrong indicator -- (small problem huh)... note how mine is wrong (look at the 4th bar in the indicator pane today) and yours is right using the same code.... this is why was just hoping for the same type of code but just re-worded in a diff't way --- I just don't know how to do it another way....

thanks for any help:

Attached Thumbnails
Rotation Factor (Market Profile Code)-wrong-code.png  
Frank is offline  
Reply With Quote
Old 04-20-2009, 09:04 PM   #4
ant

ant's Avatar

Join Date: Sep 2006
Location: USA
Posts: 421
Ignore this user

Thanks: 22
Thanked 314 Times in 81 Posts

Re: Rotation Factor (Market Profile Code)

Frank, below is a Rotation Factor indicator using EL code. Hope it helps.

Code:
vars: 
	RotationFactor( 0 );

if CurrentBar > 1 then
begin
	if Date <> Date[1] then
		RotationFactor = 0;

	if Date = Date[1] then
	begin
		if High > High[1] then
			RotationFactor = RotationFactor + 1;

		if High < High[1] then
			RotationFactor = RotationFactor - 1;
	
		if Low > Low[1] then
			RotationFactor = RotationFactor + 1;

		if Low < Low[1] then
			RotationFactor = RotationFactor - 1;
	end;
end;

Plot1(0,"ZeroLine");
Plot2(RotationFactor,"RF");
ant is offline  
Reply With Quote
The Following 2 Users Say Thank You to ant For This Useful Post:
aaa (04-25-2009), Frank (04-20-2009)
Old 04-20-2009, 09:46 PM   #5

Join Date: Jan 2008
Location: San Francisco
Posts: 394
Ignore this user

Thanks: 17
Thanked 338 Times in 156 Posts

Thumbs up Re: Rotation Factor (Market Profile Code)

thx ant, that works.

by the way,

there wasn't a single +2 RF reading today

Last edited by Frank; 04-20-2009 at 10:06 PM.
Frank is offline  
Reply With Quote
Old 04-25-2009, 05:29 AM   #6
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 443
Ignore this user

Thanks: 240
Thanked 283 Times in 136 Posts

Re: Rotation Factor (Market Profile Code)

With colored bars like in TAMS' chart

Code:
//-----------------------------------------------------
		inputs:
//----------------------------------------------------

up.color( blue );

//----------------------------------------------------
	vars: 
//----------------------------------------------------	

	RF(0);

if CurrentBar > 1 then
begin
	if Date <> Date[1] then
		RF = 0;

	if Date = Date[1] then
	begin
		if High > High[1] then
			RF = RF + 1;

		if High < High[1] then
			RF = RF - 1;
	
		if Low > Low[1] then
			RF = RF + 1;

		if Low < Low[1] then
			RF = RF - 1;
	end;
end;

Plot1( 0  , "ZeroLine" );
Plot2( RF , "RF"	  );
			
	if RF > RF[1] then
 		SetPlotColor( 1 , up.color	);
aaa is offline  
Reply With Quote
The Following User Says Thank You to aaa For This Useful Post:
Tams (04-25-2009)

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Market Profile Easy Language Code Kmlrt Market Profile 7 11-18-2008 12:22 AM
[Market Profile] Market profile / volume profile jfutures Technical Analysis 2 10-10-2008 10:08 AM
Profile Trend March + Market Profile Momentum spyro Coding Forum 12 10-04-2008 04:17 AM
Market Profile for YM tony1d E-mini Futures Trading Laboratory 13 06-16-2007 11:33 AM
Market Profile POC dupaski Technical Analysis 8 03-08-2007 12:05 AM

All times are GMT -4. The time now is 12:50 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.