NexusFi: Find Your Edge


Home Menu

 





Help modding esignal efs code


Discussion in Platforms and Indicators

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




 
Search this Thread

Help modding esignal efs code

  #1 (permalink)
manictrader
london
 
Posts: 3 since Jun 2014
Thanks Given: 0
Thanks Received: 0

Hi

I have been using this indicator for a few months and i like it but do you know any way to mod the code so it will highlight a bar yellow if it hits +8 or -8?

Thanks

 
Code
/********************************************************************
Title:		Value Chart Indicator Script for eSignal 7.x
By:         Chris D. Kryza (Divergence Software, Inc.)
Email:      [email protected]
Incept:     09/26/2003
Version:    1.0.0


=====================================================================
Fix History:

09/26/2003 -   Initial Release
1.0.0

=====================================================================
Project Description:   

David Stenhahl's Value Chart Indicator. From the book "Dynamic
Trading Indicators" by Mark Helweg and David Stendahl.

If you come across any fixes or have any ideas on how to spruce it up, I
would appreciate it if you would let me know ([email protected]).

Dislaimer: For educational purposes only! Obviously, no guarantees 
whatsoever and use at your own risk.

**********************************************************************/


//Global Variables
var grID                = 0;
var nBarCounter			= 0;
var aFPArray			= new Array();
var aArray				= new Array();
var nVarP				= null;
var bInitialized		= false;
var nTotalBars			= null;
var nMaxBars			= 200;

var nStudyMin			= -12;
var nStudyMax			=  12;


//== PreMain function required by eSignal to set things up
function preMain() {
var x;

    setPriceStudy(false);
    setStudyTitle("Value Chart");
    
    addBand(  8, PS_SOLID, 1, Color.red,  -10 );
    addBand(  4, PS_SOLID, 1, Color.teal, -11 );
    addBand( -4, PS_SOLID, 1, Color.teal, -12 );
    addBand( -8, PS_SOLID, 1, Color.red,  -13 );            

	//unrem this if you don't want the labels in cursor window
    setShowCursorLabel(false);
    
    setStudyMin( nStudyMin );
    setStudyMax( nStudyMax );
    
    setComputeOnClose();
    grID = 0;
    
    //initialize formula parameters
	x=0; 
	aFPArray[x] = new FunctionParameter( "NumBars", FunctionParameter.NUMBER);
	with( aFPArray[x] ) {
		setName( "Input: Bars" );
		setLowerLimit( 2 );
		setUpperLimit( 1000 );
		setDefault( 5 );
	}  
	x++;
	aFPArray[x] = new FunctionParameter( "MaxToDraw", FunctionParameter.NUMBER);
	with( aFPArray[x] ) {
		setName( "Max Bars to Draw" );
		setLowerLimit( 20 );
		setUpperLimit( 5000 );
		setDefault( 100 );
	}  

	for ( x=0; x<50; x++ ) {
		aArray[x] = 0.0;
	}

}

//== Main processing function
function main( NumBars, MaxToDraw ) {
var x;
var nVarA;
var nVarB;
var nVarC;
var nVarD;
var nVarE;
var nVarR1;
var nVarR2;
var nVarR3;
var nVarR4;
var nVarR5;
var nVarR0;
var nOpen, nHigh, nLow, nClose;
	
	//script is initializing
    if ( getBarState() == BARSTATE_ALLBARS ) {
        return null;
    }

	if ( bInitialized == false ) {
		nVarP = Math.round( NumBars/5 );
		nMaxBars = MaxToDraw*3;
		nMaxBars += (nMaxBars % 3)-1;
		nTotalBars = getNumBars();
		bInitialized = true;
	}

	//called on each new bar
	if ( getBarState() == BARSTATE_NEWBAR ) {
	
		aArray.pop();
		aArray.unshift(0);
	
		nBarCounter++;
		
	}

	if ( nBarCounter < (nTotalBars-(nMaxBars/3))-10 ) return;


	if ( NumBars > 7 ) {
		nVarA = Highest( nVarP, 0 ) - Lowest( nVarP, 0 );
		if ( nVarA == 0 && nVarP ==1 ) 
			nVarR1 = Math.abs( close()-close(-nVarP) );
		else
			nVarR1 = nVarA;
			
		nVarB = Highest( nVarP, nVarP+1 ) - Lowest( nVarP, nVarP );
		if ( nVarB == 0 && nVarP==1 )
			nVarR2 = Math.abs( close(-nVarP)-close(-(nVarP*2)));
		else
			nVarR2 = nVarB;
			
		nVarC = Highest( nVarP, nVarP*2 ) - Lowest( nVarP, nVarP*2 );
		if ( nVarC == 0 && nVarP==1 )
			nVarR3 = Math.abs( close(-(nVarP*2))-close(-(nVarP*3)));
		else
			nVarR3 = nVarC;

		nVarD = Highest( nVarP, nVarP*3 ) - Lowest( nVarP, nVarP*3 );
		if ( nVarD == 0 && nVarP==1 )
			nVarR4 = Math.abs( close(-(nVarP*3))-close(-(nVarP*4)));
		else
			nVarR4 = nVarD;
		
		nVarE = Highest( nVarP, nVarP*4 ) - Lowest( nVarP, nVarP*4 );
		if ( nVarE == 0 && nVarP==1 )
			nVarR5 = Math.abs( close(-(nVarP*4))-close(-(nVarP*5)));
		else
			nVarR5 = nVarE;
		
		nLRange = ( ( nVarR1 + nVarR2 + nVarR3 + nVarR4 + nVarR5 ) / 5 ) * 0.20;
	}
	else {
		if ( Math.abs( close()-close(-1) ) > (high()-low())) 
			nVar0 = Math.abs( close()-close(-1) );
		else
			nVar0 = high()-low();
			
		if ( high()==low() )
			nVar0 = Math.abs( close()-close(-1) );
			
		aArray[0] = nVar0;
			
		nLRange = Average( aArray, 5 ) * 0.20;
	}
		
		
	if ( nLRange <= 0 ) return;
	
	nOpen  = (  open() - HLAverage( NumBars ) ) / nLRange;
	nHigh  = (  high() - HLAverage( NumBars ) ) / nLRange;
	nLow   = (   low() - HLAverage( NumBars ) ) / nLRange;
	nClose = ( close() - HLAverage( NumBars ) ) / nLRange;	
	
	//adjust study window height, as necessary
	if ( nBarCounter > (nTotalBars-(nMaxBars/3))) {
		if ( nHigh > nStudyMax ) {
			nStudyMax = nHigh;
			setStudyMax( nStudyMax );
		}
		if ( nLow < nStudyMin ) {
			nStudyMin = nLow;
			setStudyMin( nStudyMin );
		}
	}		
		
	//draw the OHLC bar in the study window		
	drawBar( nOpen, nHigh, nLow, nClose );


}


/*************************************************
             SUPPORT FUNCTIONS                    
**************************************************/   

function drawBar( nO, nH, nL, nC ) {

	drawLineRelative( 0, nL, 0, nH, PS_SOLID, 3, Color.navy, gID() );
	drawLineRelative( 0, nO, 0, nO, PS_SOLID, 5, Color.lime, gID() );
	drawLineRelative( 0, nC, 0, nC, PS_SOLID, 5, Color.red, gID() );	
	
}
	

function HLAverage( nBars ) {
var x = 0;
var nTmp = 0;

	while ( x<nBars ) {
		nTmp += ( high(-x) + low(-x) ) / 2;
		x++;
	}
	
	return( nTmp/nBars );
	
}    
 
    
function Average( Arr, nBars ) {
var x = 0;
var nTmp = 0;

	while ( x<nBars ) {
		nTmp += Arr[x];
		x++;
	}
	
	return( nTmp/nBars );
	
}    
    
function Highest( nBars, nOffset ) {
var x = nOffset;
var nTmp = -9999999999.0;

	while ( x<nBars+nOffset ) {
		nTmp = Math.max( nTmp, high(-(x)) );
		x++;
	}
	
	return( nTmp );
	
}    

function Lowest( nBars, nOffset ) {
var x = nOffset;
var nTmp = 9999999999.0;

	while ( x<nBars+nOffset ) {
		nTmp = Math.min( nTmp, low(-(x)) );
		x++;
	}
	
	return( nTmp );
	
}    

    
//== gID function assigns unique identifier to graphic/text routines
function gID() {
    grID ++;
    if ( grID>nMaxBars ) grID = 0;
    return( grID );
}

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
About a successful futures trader who didnt know anythin …
Psychology and Money Management
MC PL editor upgrade
MultiCharts
Quantum physics & Trading dynamics
The Elite Circle
 
  #2 (permalink)
manictrader
london
 
Posts: 3 since Jun 2014
Thanks Given: 0
Thanks Received: 0

I have tried many things but still no luck

Basically I want to change the colour of this

drawLineRelative( 0, nO, 0, nO, PS_SOLID, 5, Color.lime, gID() );

to red if it crosses the -8 line

Reply With Quote
  #3 (permalink)
 
loschle's Avatar
 loschle 
Rheinland-Pfalz,Germany
 
Experience: Intermediate
Platform: eSignal
Broker: IB, eSignal
Trading: ES,EUR/USD,forex
Posts: 5 since Nov 2010
Thanks Given: 15
Thanks Received: 3


I am not sure if I understand what you need.
But if you want the study to look like this:

then look to attached x.efs
You can identify the changes in the "drawBar" function.
Hope it help a bit.

Attached Files
Elite Membership required to download: x.efs
Reply With Quote
  #4 (permalink)
manictrader
london
 
Posts: 3 since Jun 2014
Thanks Given: 0
Thanks Received: 0

Hi Thanks, that worked perfectly.

Really appreciate the help there!!

Reply With Quote




Last Updated on June 20, 2014


© 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