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?
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:
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
You add 1 to the value of the previous bar. You have to remove the !
The following user says Thank You to Squib for this post:
If you search for MultiCharts Cumulative Delta you'll find this has been explored in detail.
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.