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

Reply
Old 07-19-2009, 08:10 AM   #1

Join Date: May 2009
Location: hong kong
Posts: 34
Ignore this user

Thanks: 9
Thanked 2 Times in 2 Posts

EL : How to Count the Bar Passed Since ...?

Novice question . In EL , how to count the number of bars past a certain occasion ?

e.g. If the Close cross over the average 10 days ago and it return a value 10 .

I browsed the EL reserved word manual but seems cannot find some function like 'barsince' ? It should be in EL but just maybe using another term only .Can someone tell me what is the proper name of it ?

thanks in advance .
emptyvault is offline  
Reply With Quote
Old 07-19-2009, 09:15 AM   #2

UrmaBlume's Avatar

Join Date: Apr 2008
Location: Las Vegas
Posts: 670
Ignore this user

Thanks: 87
Thanked 618 Times in 251 Posts

Re: EL : How to Count the Bar Passed Since ...?

Quote:
Originally Posted by emptyvault »
Novice question . In EL , how to count the number of bars past a certain occasion ?
e.g. If the Close cross over the average 10 days ago and it return a value 10 . I browsed the EL reserved word manual but seems cannot find some function like 'barsince' ? It should be in EL but just maybe using another term only .Can someone tell me what is the proper name of it ?thanks in advance .
Vars: BarWhen(0), BarsSince(0), MA(0);

If C crosses over MA then BarWhen = BarNumber;

BarsSince = BarNumber - BarWhen;
UrmaBlume is offline  
Reply With Quote
Old 07-19-2009, 09:21 AM   #3

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: EL : How to Count the Bar Passed Since ...?

pls review these posts :
http://www.traderslaboratory.com/for...html#post68027
http://www.traderslaboratory.com/for...html#post66028
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
emptyvault (07-19-2009)
Old 07-19-2009, 12:18 PM   #4

suriNotes's Avatar

Status: Educational Partner
Join Date: Nov 2007
Location: Seattle, WA
Posts: 165
Ignore this user

Thanks: 8
Thanked 156 Times in 59 Posts

Re: EL : How to Count the Bar Passed Since ...?

Check LRO and MRO functions in EL.

Regards,
Suri


Quote:
Originally Posted by emptyvault »
Novice question . In EL , how to count the number of bars past a certain occasion ?

e.g. If the Close cross over the average 10 days ago and it return a value 10 .

I browsed the EL reserved word manual but seems cannot find some function like 'barsince' ? It should be in EL but just maybe using another term only .Can someone tell me what is the proper name of it ?

thanks in advance .
suriNotes is offline  
Reply With Quote
The Following User Says Thank You to suriNotes For This Useful Post:
emptyvault (07-19-2009)
Old 07-19-2009, 12:32 PM   #5

Join Date: May 2009
Location: hong kong
Posts: 34
Ignore this user

Thanks: 9
Thanked 2 Times in 2 Posts

Re: EL : How to Count the Bar Passed Since ...?

I tried to test the most simple work visually and wrote the following to test the code if it works for a close cross over the adaptive line .
But the result was that even the close cross below the line after two days , it still get paint bar ....really scratching my head ...
What is the mistake ?

// Adap10

inputs:
Price( Close ),
EffRatioLength( 10 ),
FastAvgLength( 2 ),
SlowAvgLength( 30 ) ;

variables:
Adap10(0) ;

Adap10 = AdaptiveMovAvg( Price, 10, FastAvgLength, SlowAvgLength ) ;


// test barsince

Vars: BarWhen(0), BarsSince(0), MA(0);

If C crosses over Adap10 then BarWhen = BarNumber;

BarsSince = BarNumber - BarWhen;

If BarsSince = 2 then
PlotPaintBar(High,Low,ope n,close,"",cyan);
emptyvault is offline  
Reply With Quote
Old 07-19-2009, 12:45 PM   #6

Join Date: May 2009
Location: hong kong
Posts: 34
Ignore this user

Thanks: 9
Thanked 2 Times in 2 Posts

Re: EL : How to Count the Bar Passed Since ...?

forgive my clumsy in EL ,
just add a phase C > adap10 then solved the problem .

I have a lot to learn about EL ....
emptyvault is offline  
Reply With Quote

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
Tick Bar Count Down torero Trading Indicators 8 05-24-2011 03:40 AM
Count Consecutive Volume Up/Down Days helitrader Coding Forum 2 03-26-2009 07:46 AM
Need explanation on TPO count tomdz Market Profile 12 09-08-2007 08:01 PM
TPO count Trader_JG Market Profile 1 02-12-2007 07:23 AM

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