Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

cunparis

Pace of Tape - Measure Trade Intensity to Detect Reversals

Recommended Posts

I'd like to share something I've been working on. I'm using trade intensity to detect buying/selling exhaustion which often leads to reversals. The reversal can be a pause, a small pullback, or a full reversal. So this isn't something one can use mechanically but rather as an input into a discretionary trading method.

 

I measure trade intensity by the amount of trades occuring in a given time. This is equivalent to watching the time & sales for periods when the trades start scrolling really fast. I find that with this indicator I no longer have to watch time & sales.

 

I'd like to get some feedback on this idea and improve it. So far I have it available for Ninjatrader & Multicharts and you can look at the source code and program it for other platforms. If you do please send me a copy so that I can make it available on my blog and make it available to everyone else.

 

I'm attaching a chart showing a bit of how I use it. I have also created a blog page and a video which explains it in more detail.

 

http://www.tradewiththeflow.com/201...tape-indicator/

 

Thanks for looking, I hope you find it useful. And good trading to everyone!

5aa71007283a5_paceoftape-tradeintensityexampleonfesx20100517.thumb.png.c9137a3b0725fca86514dfd322f8c4eb.png

PaceOfTape NT65 v1.0.4.zip

Share this post


Link to post
Share on other sites
here it is in mc. could not get it to compile in TS perhaps someone could help with that?

 

not everyone has a crystal ball

you have to post the error message if you expect someone to help

Share this post


Link to post
Share on other sites
here it is in mc. could not get it to verify in TS perhaps someone could help with that? the term " time_s " was not recognized.

 

I don't believe it will work in TS, or at least I don't believe it will be accurate, because TS only has 1 second resolution on the bars.

 

Thanks for the MC binary file.

Share this post


Link to post
Share on other sites
here it is in mc. could not get it to verify in TS perhaps someone could help with that? the term " time_s " was not recognized.

 

that's a MultiCharts exclusive keyword.

Share this post


Link to post
Share on other sites
I don't believe it will work in TS, or at least I don't believe it will be accurate, because TS only has 1 second resolution on the bars.

 

.

 

... gotta scoot...quick idea...implement with ELTic and ELToc dll's in TS?

Share this post


Link to post
Share on other sites
... gotta scoot...quick idea...implement with ELTic and ELToc dll's in TS?

 

Can you point me in the right direction? googling a couple of obvious permutations returned nothing.

Share this post


Link to post
Share on other sites
that's a MultiCharts exclusive keyword.

 

Yeah... sorry TS users. I wrote it for 'time_s' on MC because cunparis was using it on fast charts and monitoring 30-seconds or less intervals. If you want to use it on a long-enough basis that you want to see the pace of the last few minutes, then you can re-write it for plain 'time' and adjust the 240000 constant and all should be well.

Share this post


Link to post
Share on other sites
I am total inexperienced related to coding. What would I need to do try to get this indicator in EL so I could use it in OEC?

 

The multicharts version should be in easylanguage and should work, with the exception of the time_s which may not work.

 

Make sure OEC supports timestamps finer grained than 1 minute (like tradestation) or it will be less accurate.

Share this post


Link to post
Share on other sites

Thanks sadly I no longer have access to the TS forums :( if there are release notes with the .DLL's perhaps someone might cross post them. (Presuming they are public domain rather than for sale).

Share this post


Link to post
Share on other sites

The workspace will show you how it works but here's the text:

 

Cy,

 

 

Here's a TradeStation-compatible DLL that provides microsecond Tic and Toc functions.

 

Additionally, the attached DLL code demonstrates the use of the IEasyLanguageProperties interface that is available as part of the EasyLanguage Extension Software Development Kit (SDK) (tskit.dll).

 

When called from EasyLanguage, the demonstration DLL creates (starts) or returns the elapsed time of user-named microsecond timers. Two DLL functions are provided:

 

ELTic( "TimerName" ) - Used to create and start a timer with a user selected name.

 

ELToc( "TimerName" ) - Used to return the number of microseconds (millionths of a second) that have elapsed since ELTic was called for the named timer.

 

 

 

 

The following files are contained in the attached zip file:

 

EasyLanguage Tic Toc Demo.tsw - Demonstration TradeStation workspace.

 

ELTicToc.dll - Compiled TradeStation-compatible DLL.

 

Tic Toc Demo Indicator.ELD - ELD file containing the Tic Toc Demo indicator, ready for importation into TradeStation.

 

ELTicToc.sln, ELTicToc.vcproj, ELTicTocDef.def, ELTicTocMain.cpp - Together, these files comprise the Visual C++ project from which the DLL is created.

 

 

Attachment: EasyLanguage Tic Toc Demo.zip 16 kB

 

 

 

 

Running the Demo

 

Running the demonstration is a five step process:

 

1.) Download the file EasyLanguage Tic Toc Demo.zip, posted above, to your computer.

 

2.) Extract the compiled DLL contained in the zip file, ELTicToc.dll, to your installation's equivalent to the following subdirectory:

 

C:\WINDOWS\system32\

 

 

3.) Double-click the .ELD file, and import the indicator contained therein.

 

4.) Move the TradeStation workspace file, EasyLanguage Tic Toc Demo.tsw, into your \Program Files\TradeStation\MyWork\ subdirectory.

 

5.) Open the demonstration workspace during a time when live market data is flowing and ensure that the DLL-calculated performance times for a section of the demonstration code plot on the chart after 10 "real-time" ticks have passed.

 

The demonstration code waits until 10 "real-time" ticks have passed. It then uses the microsecond performance timer to measure the time it takes to run a simple EasyLanguage code loop 1,000 times. The time it takes to perform this task is plotted on the chart. (Plotted times are in microseconds (millionths of a second). To convert to seconds, divide by 1,000,000.)

 

 

 

 

How it Works

 

Most modern PC's are equipped with a high-speed counter the count and frequency of which are both programmatically accessible. (This high speed counter is separate from the computer's time-of-day clock.) This high-speed counter can be used as a timer.

 

The DLL provides two functions, ELTic and ELToc, that can be called from EasyLanguage.

 

ELTic records the current performance counter count. This count is stored using the IEasyLanguageProperties interface of the calling EasyLanguage analysis technigue. This process can be thought of as the process of "creating" a timer of a name of your choice.

 

ELToc determines the current performance counter value. It then subtracts the starting performance counter value for the named timer, the value established when ELTic was called for the timer, and returns the difference between the two, in microseconds.

 

Thus, to measure any time period is a two-step process. First, when it is desired to "start the timer", ELTic is called with a given timer name of your choice. Then, when it is desired to "stop the timer", ELToc is called with the same timer name as a parameter.

 

Multiple timers may be used in a given piece of code.

 

Timers may be nested, like this:

 

 

ELTic( "Timer1" ) ;

 

{ Code block 1... }

 

ELTic( "Timer2" ) ;

 

{ Code block 2... }

 

ELToc( "Timer2" ) ;

 

{ Code block 3... }

 

ELToc( "Timer1" ) ;

 

Of course, if nested timers are used, measured times will include both the time for code to run and the time required to call timer functions. For example, in the above pseudocode, Timer1 would measure not only the time it takes to run code blocks 1, 2, and 3, but also the time it takes to make the ELTic and ELToc calls for Timer2.

 

Measured times may not exceed 2 billion microseconds (2,000 seconds, about 33 minutes). Attempts to time events that exceed this duration will result in a return value of -1 from the call to ELToc.

 

A runtime error will be generated in TradeStation if the DLL is unable to determine the frequency of the PC's performance counter.

 

A runtime error will be generated in TradeStation if an attempt is made to read a timer that does not exist. This would occur, for example, if ELToc were called with a specific timer name before ELTic had been called with that timer name.

 

20060720153912EasyLanguage Tic Toc Demo.zip

Share this post


Link to post
Share on other sites

Ok, well I got it to compile in OEC...

 

inputs: period(30), threshold(600), normcolor(blue), highcolor(red);

vars:
 int pace(0),
 int indx(0);



pace = 0;
indx = 0; 
while(indx < CurrentBar) begin
 value1 = time - time[indx];
 if(value1 < 0) then value1 = time + 240000 - time[indx];
 if(value1 < period) then pace = pace + barinterval
 else break;
 indx = indx + 1; 
end;

//plot1(pace,"pace",iff(pace > threshold,highcolor,normcolor));
if pace > threshold then Plot2(pace,"Pace",green) 
   else Plot2(pace,"Pace",darkgray);

 

OEC didn't like the plot language so I switched it up. But I guess we need to adjust for the 240000 constant, because as far as I can tell this thing just resets on the hour...

 

What does the 240000 represent?

 

Heres how it looks right now:

attachment.php?attachmentid=21110&stc=1&d=1274453152

1.thumb.png.229143ea375a035aea51861a4fb6cce1.png

Share this post


Link to post
Share on other sites

Here's a similar approach for TS, I found a time ago.Maybe it can help.Measuring the "speed" of contracts is very interesting , but as we know TS is frome last century , unfortunately.

Here you go :

 

[LegacyColorValue = true];

 

DefineDLLFunc: "GetMachineTime.DLL",Long,"GetMachineTime";

 

Inputs: OutputType(1), {Input 1 for Minutes and fractions of minutes ( 1.50 stands for 1 minute 30 seconds )}

{Input 2 for output in minutes and seconds ( 1.50 stands for 1 minute 50 seconds)}

CapMinutes(20),

RealTimePlotClr(white), {Color of histogram plot from the time it was applied and calculating in seconds in real time )}

NonRTPlotClr(Darkgray), {Color of histogram plot before the time it was applied not calculating seconds in real time but rounded minutes )}

OverCapClr(darkred);

 

Vars: TxtID (0);

 

Array: myTimes[2](0);

 

 

If LastBarO

[code]

[/code]nChart then

begin

myTimes[1] = myTimes[0];

myTimes[0] = GetMachineTime;

Value1 = myTimes[0] * .01;

Value2 = IntPortion(Value1);

Value3 = Value1 - Value2;

Value4 = myTimes[1] * .01;

Value5 = IntPortion(Value4);

Value6 = Value4 - Value5;

Value7 = (Value3 - Value6) * 100;

 

If myTimes[1] = 0 and myTimes[0] <> 0 then

Value8 = TimeToMinutes(time) - TimeToMinutes(time)[1];

 

If myTimes[1] <> 0 and myTimes[0] <> 0 then

begin

If myTimes[1] > myTimes[0] then

Value8 = TimeToMinutes(Value2) - TimeToMinutes(Value5) + 1440

else

Value8 = TimeToMinutes(Value2) - TimeToMinutes(Value5);

end;

 

 

If OutputType = 1 then

Value9 = ((Value8 * 60) + Value7) / 60

else

Value9 = 0;

 

{

Print("TradeStation reserved word CurrentTime XYZ",CurrentTime:4:0,

NewLine,"Current Machine Time XYZ",Spaces(17),GetMachineTime:7:0," ",

(TimeToMinutes(Value2) - TimeToMinutes(Value5) + 1440));

 

Print(Value1," ", Value2," ", Value3," ", Value4," ", Value5," ", Value6," ", Value7," ", Value8," ", Value9);

Print(myTimes[0]," ", mytimes[1]);

}

 

end else

begin

If Time[1] <= 2359 and Time >= 0 and Time < Time[1] then

value9 = TimeToMinutes(Time) - TimeToMinutes(Time)[1] + 1440

else

value9 = TimeToMinutes(Time) - TimeToMinutes(Time)[1];

end;

 

If Ticks <> 0 then

Value10 = Value9 / Ticks;

 

If Value9 > CapMinutes then

Value9 = CapMinutes;

 

Plot1(Value10, "Vol/sec");

 

If myTimes[1] = 0 then

SetPlotColor(1, NonRTPlotClr)

else

SetPlotColor(1, RealTimePlotClr);

 

If Value9 = CapMinutes then

SetPlotColor(1, OverCapClr);

 

 

 

regs

_GetMachineTime.zip

Share this post


Link to post
Share on other sites
Here's a similar approach for TS, I found a time ago.Maybe it can help.Measuring the "speed" of contracts is very interesting , but as we know TS is frome last century , unfortunately.

 

Thats the same one I linked a couple of posts ago. :) You can find a couple of charts I posted in the original trade intensity thread using this code. I actually rather like the indications it gives (small bars represent intense trade).

 

Always thought intensity needs some sort of smoothing (which again was discussed before) it can go from very close to zero to pretty darn massive in one tick.

 

It would be pretty trivial to convert to intensity. Isn't time taken pretty close to the reciprocal of intensity any way? Too early to think about for now:)

Share this post


Link to post
Share on other sites

I missed this "intensity"thread , and worked through it a few hours ; )

interesting , how often people got the same ideas at the same time (sometimes)

anyhow ,I think I tried to convert this to intensity in the past but did not suceed and left it.I believe I gave up on this "tick-based" chart construction thing instead of "time based" in TS.

Maybe you can post a link to your charts, I could not find them.

regs

Jojo

Share this post


Link to post
Share on other sites

Hi guys,

 

I have found an MC version of the Pace of tape indicators.

Unfortunately, code is not working for TS, unknow words for "time_s"

i have tried to fix it without success, any help on it will be appreciate it

 

See text and links below:

 

inputs: period(30), threshold(600), normcolor(blue), highcolor(red);

 

vars:

int pace(0),

int indx(0);

 

 

 

pace = 0;

indx = 0;

while(indx < CurrentBar) begin

value1 = time_s - time_s[indx];

if(value1 < 0) then value1 = time_s + 240000 - time_s[indx];

if(value1 < period) then pace = pace + barinterval

else break;

indx = indx + 1;

end;

 

plot1(pace,"pace",iff(pace > threshold,highcolor,normcolor));

 

link:http://www.tradewiththeflow.com/wp-content/uploads/2010/05/PaceOfTape-MC-Source.txt

 

Cheers,

Larry

Share this post


Link to post
Share on other sites
Hi guys,

 

I have found an MC version of the Pace of tape indicators.

Unfortunately, code is not working for TS, unknow words for "time_s"

i have tried to fix it without success, any help on it will be appreciate it

 

See text and links below:

...Larry

 

forget it...

 

TIME_S is an EasyLanguage extension created by MultiCharts'

 

TradeStation does not do sub-minute analysis.

You have to get the DLL posted here in one of the posts.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.