ocram1980 Posted October 31, 2023 Report Share Posted October 31, 2023 (edited) Hello. I am searching for Volumespikes. I compare them to the Moving average based on the volume bars. Especially near the open it is important that the Moving Average also uses the PreMArket Date. If not I always get alerts. I thought If I choose in the scanner "Extended Hours = Always" This should be ok. But it is not. MT calculates the MA based on the volume only for the regula session. How can I fix this? Thanks! I use this code: // Reversal Volume Spike if (Volume_Bar > ((Volume_SMA)*1.5) && Volume_Bar[1] > Volume_SMA[1] && BarVolume > 30000) { // Reversal Top if (Close > Open && Close[1] > Open[1] && Close[2] > Open[2] && Close[2] < Close[1] && Close[1] < Close && RSI_Line > 70) { SetColor(0, Color.DarkGreen); TriggerAlert("Vol Spike Top", @"Vol Spike Top"); SetScanResult(@"Vol Spike Top"); SetScanResult(1,Volume_Bar); SetScanResult(2,Volume_SMA); } // Reversal Bottom if (Close < Open && Close[1] < Open[1] && Close[2] < Open[2] && Close[2] > Close[1] && Close[1] > Close && RSI_Line < 30) { SetColor(0, Color.DarkRed); TriggerAlert("Vol Spike Bottom", @"Vol Spike Bottom"); SetScanResult(@"Vol Spike Bottom"); SetScanResult(2,Volume_Bar); SetScanResult(3,Volume_SMA); } Edited October 31, 2023 by ocram1980 Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted October 31, 2023 Author Report Share Posted October 31, 2023 I recognized, when I click on the Alert, to show the chart, It first opened the chart only with bars within the regular session. And after a few seconds he added the ETH. Is it possible that the scanner calculate the data without ETH, because the data is to slow? Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted November 1, 2023 Report Share Posted November 1, 2023 I checked, and the MA is calculated on whatever shows, if you show premarket, MA is calculated using premarket values. Of course, as soon as the market starts, the volume jumps, becomes way over MA and you would get an alert. What you see (first opened the chart only with bars within the regular session. And after a few seconds he added the MA) is if you don't have premarket data to begin with, and get it from a backfill. But once you do get the backfilled data, next time you open the chart, it will be there. Also - alerts in MT only happen on "latest" data - that is, if you have a chart for a day and the alert condition is satisfied let's say 20 minutes ago, it won't trigger. It is only triggered on the last - rightmost - candle. Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 1, 2023 Author Report Share Posted November 1, 2023 Hi Mike. Thanks for the response. My scanner runs on the 5 min chart. I know that in the opening I have volume spikes and they would trigger my alert. This is why I use the parameter to start the scanner at least 10 min after the open. And I know that the scanner will only use the latest candle on the right. Anyway I think there is a problem.. I started my trading day today late. So I just went into trading (2 hours before the close). After 10 minutes the scanner starts alerting almost all my 200 stocks of the watchlist. So this time it is not the problem with premarket. It is the problem with backfill data... The scanner uses only the live data, and not the backfill data. Attached there is a screenshot which shows the problem exactly. In picture_1 you see the alert on SQ. In the column "Scan R1" you see the volume of the calculation which is 53,512. In column "Scan R2" you can see the value of the Moving Averag on the volume which is 7,354.20. This is why I got the alert, beause the volume of the bar is more than 1.5 times higher than the moving average on the volume bar. And you can see it fits with the chart. Right on the bottom there are the same values. But on this chart there is still no backfill data. So the value of the Moving Average is wrong because it is calculated WITHOUT the back fill data. I can not use this values. MT has to calculate only including the backfilldata. On "Picture _2" you can see the Values of the SQ chart a few seconds later. As you can see the Volume is a bit higher because its a few seconds later. But the important thing is the Moving Average is near the value of the volume. Maybe even a bit higher than the Volume bar. So no Way there is a volume spike. So my problem is still the MT dont uses the backfill data. How can I fix this? Thanks in Advance! Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 1, 2023 Author Report Share Posted November 1, 2023 (edited) Maybe I am just stupid. Do I have to check this on? Or to change my question above from the previous post: How do I say MT that it should backfill all stocks from my portfolio, for the current day including Premarket BEFORE it starts scanning?? I think this is the correct question. Edited November 1, 2023 by ocram1980 Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted November 3, 2023 Report Share Posted November 3, 2023 Yes, Auto-Backfill needs to be checked if you want all the stocks in your portfolio to be backfilled before a scan (and of course if your scan needs past data). Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 3, 2023 Author Report Share Posted November 3, 2023 Thank you very much. Its getting better and better with MT. Its a great Tool but I still have to learn how to use it. Thanks for your fast support. I appreciate it very much. Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 3, 2023 Author Report Share Posted November 3, 2023 Hello Guys. I am sorry for asking again. But: With activating "Auto-backfill" it draws the premarket data in the chart. This is ok. But in my opinioin the calculation is still without Premarket data. As you can see in the screenshot: The EMA in the chart for the current candle is near 43,000. 20 bars before (This is during pre MArket) the EMA is about at 14,000. On the left I printed 4 colums: ScanR1 = current Volume ScanR2 = current EMA on the Volume ScanR3 = current EMA on the Volume 1 bar before ScanR4 = current EMA on the Volume 20 bars before So you can see the calculation in "ScanR2" is at 27,790. It should be at 43,000 ScanR4 is at 220. about equal to zero. It should be at about 14,000. The Calculation is too less. What do I wrong? Thanks in Advance! Marco. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted November 5, 2023 Report Share Posted November 5, 2023 1. EMA is weird. It wants a LOT of data. 2. You do have the extended hours in scan set to "Always" same as in the chart right? 3. Try this: if your chart is showing let's say 20 days, do a SetDaysNeeded(20) call in your paintbar code. Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 6, 2023 Author Report Share Posted November 6, 2023 On 11/5/2023 at 5:46 AM, Mike Medved said: 1. EMA is weird. It wants a LOT of data. 2. You do have the extended hours in scan set to "Always" same as in the chart right? 3. Try this: if your chart is showing let's say 20 days, do a SetDaysNeeded(20) call in your paintbar code. As you can see in the screenshot I set the "Extended Hours" to "Always". And as you can see in the attached code, I included the code " SetDaysNeeded(20);" But it did not work. You can see in the Screenshot the chart and the calculation for CARR. The EMA in Premarket should be near 10-20K. But it is near zero (0.364). Thanks for helping. I appreciate very much! Strategy.PBExport Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted November 12, 2023 Report Share Posted November 12, 2023 OK I got your scan. Help me here so I don't have to dig through this - do I have to run the scan during the day or afterhours is ok? Which particular symbol does it fail on and what exactly is it showing that is incorrect? Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 16, 2023 Author Report Share Posted November 16, 2023 Thanks. I will watch it closely and try to find an example. Currently I got no problems. Confusing. Let me start with a similar question: I am already running the scanner for 1.5 hours. But TSLA has still not filled the historic data? I see this every day. Always with TSLA. What is going on with this stock? Marco. Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 17, 2023 Author Report Share Posted November 17, 2023 I forgote to post the screenshot. will post it later when the market is open. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted November 18, 2023 Report Share Posted November 18, 2023 On 11/16/2023 at 10:26 AM, ocram1980 said: Thanks. I will watch it closely and try to find an example. Currently I got no problems. Confusing. Let me start with a similar question: I am already running the scanner for 1.5 hours. But TSLA has still not filled the historic data? I see this every day. Always with TSLA. What is going on with this stock? Marco. Not sure. But you can manually backfill. Just right click on TSLA and choose the option to backfill. Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 21, 2023 Author Report Share Posted November 21, 2023 Hello. Mike. Thanks. It is not working. At least not for TSLA. I was 1 hour in trading and TSLA was still not backfilled. I used your idea to backfill manually. But it still did not fill after 15 min or so... see screenshots. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted November 22, 2023 Report Share Posted November 22, 2023 What source are you using for backfills again? Quote Link to comment Share on other sites More sharing options...
ocram1980 Posted November 24, 2023 Author Report Share Posted November 24, 2023 On 11/22/2023 at 11:48 PM, Mike Medved said: What source are you using for backfills again? dxfeed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.