NexusFi: Find Your Edge


Home Menu

 





UpTick/Downtick Calculations


Discussion in EasyLanguage Programming

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




 
Search this Thread

UpTick/Downtick Calculations

  #1 (permalink)
 
clement's Avatar
 clement 
Vancouver
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB/IQFeed
Trading: YM
Posts: 6 since Dec 2011
Thanks Given: 3
Thanks Received: 0

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

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Better Renko Gaps
The Elite Circle
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #3 (permalink)
 
Squib's Avatar
 Squib 
Bavaria/Germany
 
Experience: Advanced
Platform: MultiCharts, MT4, NT
Trading: EUR/USD
Posts: 4 since Jan 2012
Thanks Given: 4
Thanks Received: 1



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
Thanked by:
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,173
Thanks Received: 101,538

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

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on January 13, 2012


© 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