Resetting Scanner Studies which abort.

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2028
Joined: 21 Jul 2007
Has thanked: 174 times
Been thanked: 405 times

Resetting Scanner Studies which abort.

Postby bowlesj3 » 21 Aug 2017

Hi,

every so often I get an error in my 1 script I am using in the scanner. So I was wondering if that script gets turned off for that symbol+resolution cell in the scanner. To determine for sure if my theory was correct I submitted some Global variables to test if the script was being run for this symbol+resolution combination and if detected it would write out a message with a file append. So since I see no messages I have to assume the error has turned off the study. I did a right click on the study cell and there appears to be no way to turn the study back on. I was thinking that a recompile might turn it back on but I realized that this does not turn it back on in the chart so it will not likely turn it back on in the scanner either. I will be really surprised if there is no way to turn a study back on. What is the solutions to this? Do I delete the symbol from the scanner and put it back?

Also I get no info as to why it was turned off. I seem to remember that when a study aborts like this in a chart it gives a bit more info (it has been a long time since I have seen one in a chart).

Thanks,
John

User avatar
Henry MultiСharts
Posts: 8503
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2731 times

Re: Resetting Scanner Studies which abort.

Postby Henry MultiСharts » 22 Aug 2017

Hello John,

Does your script do any plots in the scanner? Can you see any values / messages displayed by the study for the instrument in question in the scanner?

bowlesj3
Posts: 2028
Joined: 21 Jul 2007
Has thanked: 174 times
Been thanked: 405 times

Re: Resetting Scanner Studies which abort.

Postby bowlesj3 » 22 Aug 2017

Henry MultiСharts wrote:Hello John,

Does your script do any plots in the scanner? Can you see any values / messages dispalayed by the study for the instrument in question in the scanner?


Hi Henry, I just got back from the computer store with an upgrade from 8 gig of ram to 16 gig of ram. I am not sure if that may help.

I just searched the script for "Plot" and all the paint bar plots were commented out by myself many years ago so it has zero plots. It puts text out fairly often marking the unit size of the swing highs/lows. So the scanner ignores these text items as I assume it should. It sends a lot of GV values out. The only info in the abort message is the script name and the resolution. I would guess that I have seen it abort maybe 4 to 6 times. Normally it was doing it in he 5 minute bar resolution. For sure I saw it abort once in the daily bar resolution. I have put all my resolutions in now (weekly, daily, 30 minute, 15 minute, 5 minute). We will see what happens I guess.

The script was originally written in 2007. I made a few enhancements over maybe 2 years and after that it was pretty much unchanged as best as I remember. It was running on the S&P 500 e-mini. Now it is running against stocks. I have not seen it abort on a chart yet since I came back to trading and I don't remember having any problems with it since I first got it working. I will not be scanning to dump stuff into the watch list (the scan every X minute is unchecked). Instead my database program will be running a form with a timer that every second checks for Global variable values to notify me that a trading opportunity may be present which I should verify visually. I am doing this because I did a test and the scanner seems to be running the script often enough that this approach will work.

I don't think this will have any impact on the error but I will mention one last thing. The script is also running in the 5 resolutions of the charts that I pull up with a link to the scanner. The same script also runs on a 1 minute bar chart which is also linked to the scanner. When I am considering a trade I will open a special workspace with all these same chart resolutions and the 1 minute bars of this workspace will have the chart trader in effect. This way I can watch one or more open positions while still being notified of other trade setups coming into effect.

User avatar
Henry MultiСharts
Posts: 8503
Joined: 25 Aug 2011
Has thanked: 1213 times
Been thanked: 2731 times

Re: Resetting Scanner Studies which abort.

Postby Henry MultiСharts » 24 Aug 2017

John, if any error message appears when the study is aborted - please attach a screenshot of it.
Please also add this code to your study

Code: Select all

plot1("");

It will not plot anything in the scanner while it runs ok, but if the study throws an error it will say "Error" in the cell for this symbol/study.
Also the indicators are not being turned off in the scanner, if you recompile the study it will be recalculated in the scanner.
These users thanked the author Henry MultiСharts for the post:
bowlesj3

bowlesj3
Posts: 2028
Joined: 21 Jul 2007
Has thanked: 174 times
Been thanked: 405 times

Re: Resetting Scanner Studies which abort.

Postby bowlesj3 » 24 Aug 2017

Okay thanks Henry. I just inserted Plot1(""); within the LastBarOnChart if statement before the RecalcLastBarAfter(1); command. I added a comment.
Plot1(""); {This command forces the word "Error" to appear in a scanner cell where a study aborts. This command does not create a plot in the scanner.}


I have not seen an error in maybe 3 days. I am suppose to set GVs in my database program before I start MC for the day. These are the swing size settings and the text spacing above/below price. Normally if I forget to set these this has no effect except bypassing the swing code. However I am wondering if some extra situation might be triggering the error when I forget. The habit of starting my database first is getting established now. This plus the extra memory may have resolved the situation.

It is nice to know that recompiling resets things in the scanner.
These users thanked the author bowlesj3 for the post:
Henry MultiСharts

bowlesj3
Posts: 2028
Joined: 21 Jul 2007
Has thanked: 174 times
Been thanked: 405 times

Re: Resetting Scanner Studies which abort.

Postby bowlesj3 » 18 Sep 2017

I finally got another error in a study that is only running in the scanner. I attached an image. Having an error in the scanner is pretty rare. This is a very simple script. It is shown below.

Code: Select all

{A_My_SwingCode_Clear - this script sets the shift }

variables:
   RunByChartOrScanner(""),
   LogPath(""),
   LogFile(""),
   MySide(""),
    RealSym(""),
   BarSize(""),
   BarType(""),
   BarSizeType("");
if CurrentBar = 1 then
   Begin
   if GetAppInfo(aiApplicationType) = 1 then {Chart not scanner}
      RunByChartOrScanner = "C"
   else
      RunByChartOrScanner = "S";

       RealSym = getsymbolname;

     switch bartype_ex
      begin
       {
         NumericSimple bartype_ex [of Data(*)] - returns MC adaptable symbol resolution info:
         Tick = 1, // Tick
         Volume = 8,
         Second = 9,
         Minute = 2,
         Hour = 3,
         Day = 4,
         Week = 5,
         Month = 6,
         Year = 7,
         Quarter = 10,
         Points = 11,
         Change = 12,
         OrigPoints = 13,
      }       
      case 1: {tick bars}
         BarType = "T";
      case 2: {minute bars}
         BarType = "M";
        case 4: {daily bars}
         BarType = "D";
        case 5: {weekly bars}
         BarType = "W";
      case 9: {second bars}
         BarType = "S";
          Default:
         raiseruntimeerror("A_MY_RSI_HighestForTheDay has invalid bartype_ex. Aborting.");
         end; {switch MySide}
   BarSize = numtostr(barinterval,0);
   BarSizeType = BarSize + BarType;     

   LogFile = "A_My_SwingCode_Clear.txt";
   LogPath = "C:\Users\John Bowles\Downloads\" + LogFile;
   {
   if RunByChartOrScanner = "C" then
      Filedelete(LogPath);
   }
   end; {if CurrentBar = 1 then}

if LastBarOnChart then
   begin
   value1 = A_GV_SetNamedString(RealSym + "_ShiftExists_L_" + BarSizeType,"N");
   value1 = A_GV_SetNamedString(RealSym + "_ShiftExists_S_" + BarSizeType,"N");
     RecalcLastBarAfter(1);
     Plot1("");   
   end;
Attachments
ErrorMess.png
ErrorMess.png (121.67 KiB) Viewed 124 times

bowlesj3
Posts: 2028
Joined: 21 Jul 2007
Has thanked: 174 times
Been thanked: 405 times

Re: Resetting Scanner Studies which abort.

Postby bowlesj3 » 17 Nov 2017

I am running a single study in the scanner. I get error message popups about 15 times a day. There is no info at all to help know where this might be happening. Here is the text.

Date and time
Instrument: (symbol letters)
Resolution: 15 Minute (it can be in any resolution 1W 1D 30M 15M 5M 1M).
Message: Error in study (the line number would be helpful or even the type of error).
"Name of the study": (Symbol-15 Minute):


I am scanning 71 symbols with 5 resolutions for a total of 355 script runs for the day but only an average of 15 aborts happen each day. The study seems to keep going (I think). However I get kind of tired of clicking these popups. I would love to fix this if it is my indicator causing the problem. Maybe I need to make this a feature request to provide more info in the popups.


Return to “MultiCharts”