When does the scanner run the scripts.  [SOLVED]

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

When does the scanner run the scripts.

Postby bowlesj3 » 17 Aug 2017

Hi, I was watching a video about the MC scanner and it said that the the yellow flashes on the symbol column indicate the script has processed another tick. Assuming this is correct does that also apply to the scanner or do the scanner studies only run when the scan takes place for moving studies to the watch list. I can't check right now. I lost my scanner workspace scanner window and I am trying to recover it.

Thanks,
John

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: When does the scanner run the scripts.

Postby Henry MultiСharts » 23 Aug 2017

Hello John,

The yellow flash means the symbol received realtime price update.
If "Update on every tick" is enabled:
Pre-scanner calculates the scripts upon Rescan. There can be multiple new ticks, therefore multiple study calculations, while Rescan is being done.
Watchlist calculates the scripts upon each new incoming tick.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: When does the scanner run the scripts.

Postby bowlesj3 » 23 Aug 2017

Hello John,

The yellow flash means the symbol received realtime price update.
If "Update on every tick" is enabled:
Pre-scanner calculates the scripts upon Rescan. There can be multiple new ticks, therefore multiple study calculations, while Rescan is being done.
Watchlist calculates the scripts upon each new incoming tick.
Thanks Henry. Maybe I misinterpreted your answer but it sounds like you are saying that the studies in the pre-scanner section do not get run until a ReScan of all symbols is executed. However my tests suggest otherwise. Here is what I have noticed.

First I unchecked the checkbox which initiates ReScans every X minutes. I also do not click the button that forces a ReScan. Lastly all the script entries in the Pre-Scanning section are checked as "Update on every tick". In this situation I have noticed that Pre-Scanning section shows the yellow flashes suggesting it is executing the studies. So I was wondering if it might be executing them but not as often as I want so I decided to write out a file append during last bar on chart. So when I did this I noticed that the file was growing very quickly suggesting that just maybe it is running the script on every tick. So this would make sense since each cell of the Pre-Scanning section is set with properties "Update on every tick". It does not surprise me that there is a bit of a delay/catch-up going on. That's fine.

Regarding the use of the watchlist I find the single criteria for loading it during Pre-Scanning is not adequate so I have used my database program to take care of that as I mentioned in another post. It all seems good so far. I have a lot of entries in the pre-scanning section. MC has complained about memory so I upgraded to 16 gig. It still complains so I am going to reduce the number of entries for now. Eventually when everything is finalized I will know how many (symbols X resolutions) I can process based upon the Global Variables limit. It may just be that this limit comes in below the Scanner's limitations such that I get no memory warnings from the Scanner even with 16 gig. I learned today that I can get computer's with a motherboard with 4 memory slots that can take 16 gig memory sticks for up to 64 gig of memory max (the store I called has not seen a computer that can handle the 96 gig capacity of Win 7).

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: When does the scanner run the scripts.

Postby Henry MultiСharts » 24 Aug 2017

John, do you use RecalcLastBarAfter in your code?

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: When does the scanner run the scripts.

Postby bowlesj3 » 24 Aug 2017

John, do you use RecalcLastBarAfter in your code?
Yes. It is set as RecalcLastBarAfter(1); and is executed as the last statement within the LastBarOnChart if statement.

That is interesting. It has been a while since I first put in that command and it took me a while to remember why I used that command. I think I was moving text or lines on the chart as a way of feeding commands to the chart and I needed the recalc to detect that I had moved something. Currently I am not doing that so now you have me wondering if I need the command :-) If ticks coming into the pre-scan section do not force execution of the script without a scan run occurring and this command does force execution of the script then I do need it. I also just remembered that I am adjusting swing code swing sizes via GVs with a recalculate(); command being issued so I see the new results. The RecalcLastBarAfter(1); forces the recalculate(); command to execute which in turn gives me the immediate results I need (needed since some of these stocks trade thin).

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: When does the scanner run the scripts.  [SOLVED]

Postby Henry MultiСharts » 24 Aug 2017

I unchecked the checkbox which initiates ReScans every X minutes. I also do not click the button that forces a ReScan.
Based on the setup you have described above - RecalcLastBarAfter is the only reason and trigger for study calculation in your environment.

bowlesj3
Posts: 2180
Joined: 21 Jul 2007
Has thanked: 227 times
Been thanked: 429 times

Re: When does the scanner run the scripts.

Postby bowlesj3 » 24 Aug 2017

Thanks Henry. I guess one could say RecalcLastBarAfter is a very useful multi-purpose command. More useful than I realized :-)


Return to “MultiCharts”