UpTick/Downtick Calculations - futures io
futures io futures trading



UpTick/Downtick Calculations


Discussion in EasyLanguage Programming

Updated by Big Mike
      Top Posters
    1. looks_one clement with 1 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 Squib with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 6,419 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 3 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

UpTick/Downtick Calculations

(login for full post details)
  #1 (permalink)
Vancouver
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB/IQFeed
Trading: YM
 
clement's Avatar
 
Posts: 6 since Dec 2011
Thanks: 3 given, 0 received

Hi guys,

I wrote a short snippet to count the number of upticks and downticks in Multicharts. I wrote this as I am not sure the default "UpTicks" and "DownTicks" reserved keyword does what it is suppose to, which is to count UpTicks as the number of ticks that are done at a higher price then the tick immediately preceding it and vice-versa for DownTicks. I am unsure because UpTicks + DownTicks = Ticks, which means that each tick is always higher or lower than the preceding tick and that there are no ticks that are done at the same price at the preceding tick. I'm not sure what the UpTicks and DownTicks values are counting, if somebody could clarify it would be greatly appreciated. Anyways, I wrote the short code snippet below but I cannot get it to update properly on a 100-tick chart. I want to count all the upticks within the 100-tick chart. It looks like if the 100-tick chart moves up, upticks only go up by one, instead of all the upticks withing the 100-tick bar. It is also incredibly slow to calculate. Do I have some big inefficiency in my code? Or is what I am asking just really too much to calculate in real-time?

 
Code
Inputs: 
    UpColor( Green ),
    DownColor( Red ),
    DailyReset( true );
Variables:
    intrabarpersist UpTick( false ),
    intrabarpersist DownTick( false ),
    intrabarpersist avgTicks( 0 ),
    intrabarpersist cumulativeTicks( 0 ),
    intrabarpersist upTickCount( 0 ),
    intrabarpersist downTickCount( 0 );
    
once cleardebug;

if DailyReset and time = 0630 then cumulativeTicks = 0;

UpTick = close > close[ 1 ];
DownTick = close < close[ 1 ];

if UpTick then UpTickCount = upTickCount[ 1 ] + 1;
if DownTick then DownTickCount = downTickCount[ 1 ] + 1;

if UpTick then cumulativeTicks = cumulativeTicks[ 1 ] + 1;
if DownTick then cumulativeTicks = cumulativeTicks[ 1 ] - 1;

avgTicks = XAverage( cumulativeTicks, 3 );

print( "========= Bar ", currentbar );
print( "UpTicks: ", upTickCount, "; DownTicks: ", downTickCount );
print( "CumulativeTicks: ", cumulativeTicks ); 

Plot1( cumulativeTicks, "Cumulative Ticks" );
Plot2( UpTickCount, "UpTick Count" );
plot3( DownTickCount, "DownTick Count" );

condition1 = UpColor >= 0 and DownColor >= 0;
if condition1 then
    begin
        value1 = NormGradientColor( cumulativeTicks, true, 14, UpColor, DownColor );
        SetPlotColor( 1, value1 );
    end;
Many thanks,
Clement

Reply With Quote

Can you help answer these questions
from other members on futures io?
Times and Sales more data to be displayed
TradeStation
is there an easy way to obtain by code the price variation percentual
MultiCharts
Stacked Imbalances.
Sierra Chart
IB Bracker Order
Platforms and Indicators
T​​​​​​radestation datafeed (real time and historical) to NT8
NinjaTrader
 
 
(login for full post details)
  #3 (permalink)
Bavaria/Germany
 
Experience: Advanced
Platform: MultiCharts, MT4, NT
Trading: EUR/USD
 
Squib's Avatar
 
Posts: 4 since Jan 2012
Thanks: 4 given, 1 received



clement View Post
Hi guys,
I'm not sure what the UpTicks and DownTicks values are counting, if somebody could clarify it would be greatly appreciated.

Hi Clement,
when you use upticks/downticks instructions, you have to ensure, that you have set Build Volume On is set to Tick Count (Format Instruments - Settings).
UpTicks counts only ticks, which are higher then the preceding.
DownTicks counts only ticks, which are lower then the preceding.

Regarding your code. I think the problem is following:
 
Code
UpTick = close > close[ 1 ];
DownTick = close < close[ 1 ];
You compare the close of the previous bar with the current tick. The previous bars close does not change...
You need to store the previous tick in a separate variable and compare it then against the current tick.
A similar problem is with
 
Code
UpTickCount = upTickCount[ 1 ] + 1;
You add 1 to the value of the previous bar. You have to remove the [1]!

Reply With Quote
The following user says Thank You to Squib for this post:
 
(login for full post details)
  #4 (permalink)
Site Administrator
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,050 since Jun 2009
Thanks: 31,658 given, 94,916 received

If you search for MultiCharts Cumulative Delta you'll find this has been explored in detail.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > UpTick/Downtick Calculations


January 13, 2012


Upcoming Webinars and Events
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts