+1 888 340 6572
MultiCharts Project Management
Go to the previous open issue
Go to the previous issue (open or closed)
Please log in to bookmark issues
Open Feature request MC-423

More methods to execute a study.

Go to the next issue (open or closed)
Go to the next open issue

There have been several people ask for a timed method of executing studies rather than having to wait for a tick to come in. This would be very useful for slow markets symbols especially. Here is my request.

Have 4 (or more) methods of executing a study (also with the ability to set all 4 of them as true but do not allow an overlap).
1/ execute on every tick (every trade)
2/ execute on every change in bid.
3/ execute on every change in ask.
4/ execute on every regular interval of X seconds (example .5 seconds).
5/ execute on FKey? pressed.
I am thinking that maybe a trader would want a study to run every X seconds as a way to be notified if ticks stop (maybe a special study just for this). In another situation maybe a trader would want a study to run if there is a trade or any change in bid or ask. Regarding my concern about overlap, if a trade comes through which causes the bid to change I think the system would somehow need to know not to execute the study twice. Such a feature would obviously need to be well thought out and tested, as well as fully understood by the trader (as always).
Lastly if such a feature was put in the study would need reserve words to know what caused the study to execute since the trader may want to be selective about the code they want to run within the study. Thus the trader could use code like this;
If TradeOccurred = true then
if BidChangeOccurred = true then
if AskChangeOccurred = true then
if TimerExecution = true then

if FKey? = true then
if TradeOccurred = true and (BidChangeOccurred = true or AskChangeOccurred= true) then
In the last statement the EL engine would eliminate the overlap but the trader could detect it and act accordingly if they want.

Steps to reproduce this issue

Not applicable.

Comments (10)
user-offline.png  Stan_MultiCharts (Stan_MultiCharts)
Jun 15, 2011 - 06:14

RecalcLastBarAfter(seconds) is the keyword timer that you are asking for. It's already implemented. Otherwise the study will be recalcualted on every tick in real-time with IOG, or at the close of the bar without IOG.

user-offline.png  John Bowles (bowlesj3)
Jun 15, 2011 - 08:10

I have not tried RecalcLastBarAfter(seconds) but it sounds like it may be much like the recalculate command. This is not what I am asking for if it is true. Recalculates the whole study which is not what I mean. I am meaning the study should process every X seconds just like it would process if a new tick came in. In other words it simulates a new tick coming in every X seconds and thus executes only the "last bar on the chart" code.

user-offline.png  John Bowles (bowlesj3)
Jun 15, 2011 - 08:23

Regaring executing a study via an F# key, this would be different (I was going to remove it but I can not figure out how to edit the post). Anyway, in this case it would be a recomplete recalculation of all bars in the study rather than just executing a study similar to when it is executed like a new tick coming in. The user would need to have a fast way to select the study (or maybe a few studies in a list) so that it would not be hard to force a recalculate. If a few studies were assigned for fast F# recalculation the user would need to be able to change the order and be able to see what chart they had come from.

user-offline.png  Stan_MultiCharts (Stan_MultiCharts)
Jun 15, 2011 - 08:35

You can recalculate the entire study by turning it off and on again, or reloading the chart. The RecalcLastBarAfter does act like a trigger (i.e. a new tick coming in). I'm not sure what else you are asking for.

user-offline.png  John Bowles (bowlesj3)
Jun 15, 2011 - 08:43

Thanks Stan for clarifying the RecalcLastBarAfter(1) statement. 
Actually I at times do recalculate the whole study by turning it off and on. However I rarely do this. Instead I use the recalculate command which is an unsupported reserve word. This link has an example of my use of the recalculate command in a nice formated code block.

user-offline.png  John Bowles (bowlesj3)
Jun 15, 2011 - 09:01

the RecalcLastBarAfter(1) statement would be okay if it can be set up in a way such that it can be exceuted over and over every X statements and if there is a way to test that the study is being executed as a result of this statement such that select code and be executed. In other words the trader may want to by large amounts of code if execution is not the result of an actual true new tick coming in. My thinking is that the code for timed execution of a study will often be placed at the very top of a study and the trader will want to use an exit study in the event that the study has only been executed as the result of a timer statement. However if a tick has come in at the same time the trader will want the code to drop down and execute as normal.

user-offline.png  John Bowles (bowlesj3)
Jun 15, 2011 - 13:38

After thinking about this a bit more, maybe overlap is not actually possible. In this case I guess a single field indicating where the study was called from would do the trick. However I have had experiences in my database program where I execute a study before the first call is complete. What I do there is I set a switch at the start indicating the code was started and when it is done I set this switch off. That way if it gets called too fast from somewhere else I bypass that second call so things do not get messed up (a fun bug to figure out until one realized what is going on). So in the case of this idea, if a tick has called the script a switch should be set on so that the timer call would be rejected since there is no need for it. I suppose the highest priority would be the last tick. The other option is to have studies which are only called by timers and studies that are only called by ticks etc. In my case I could live with this last option.

user-offline.png  John Bowles (bowlesj3)
Jun 16, 2011 - 08:40

This thread has some ideas on setting up reserve words to test when an execution method started and ended.

user-offline.png  John Bowles (bowlesj3)
Aug 16, 2011 - 18:29

One use for this feature idea is to have it running a study off hours when there is no datafeed. If this was available I would immediately write a study to look for active text (meaning text I have highlighted which was created from another study during the trading day). Actually this type of study could be used to look at any active arrow, line or text for that matter. However if text could be made into an icon (like Qcharts can do) I could highight it and make it full size if a study was running using this timer idea. I could highlight the text again and have it go back to an icon. The idea is to take notes during the day and expand them after hours by simply highlighting them. The text could even contain a number which is a key number from a database file and the full description would show at the bottom of the chart (I could actually do that now without the text icon feature). I will create a new feature idea to have text show as icons or be completely hidden on mass and brought back on mass to show as icons.

user-offline.png  John Bowles (bowlesj3)
Aug 25, 2011 - 08:06

It occured to me this morning that it would make sense (considering the suggestion in the last comment I added) that the timer execution of a study have an additional option to run (only online, only offline, both). The study I would like to write would run "only offline" since it would involve highlighting a small text box and expanding the text comment at the bottom or top of the chart. These would be comments on trades I would be involved with during the day. The small text box would be there so I do not clutter up the chart too much (and I could even hide them on mass). If they were exposed during the off hours period the timer study would make it so I could highlight the small text box and get the full comment at the bottom or top of the chart out of the way of prices. These larger comments would come from some sort of database and even an MC only user could create such a database in a text file using the map comments to load it and get at it. Text boxes in the top right area of the chart would be used as intereactive input items (using MC_Text_GetActive) to control this off hours study.

Issue basics
  • Type of issue
    Feature request
  • Category
  • Targeted for
    MultiCharts 8.5 (RELEASED)
  • Status
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (3)
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Resolution
    Not determined
  • Severity
Attachments (0)
There is nothing attached to this issue
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates