Is it possible to code an indicator so that it is only triggered during the last 30 seconds of a time bar eg, on a 5 minute chart, for it to be valid between 080430 and 080500, and then again between 080930 and 081000 and so on? I’d like to use an alert with indicators, but if it’s set on real time, it may constantly go off, but if it’s set for end of candle, then I might miss the entry at the start of the next candle. I looked to specify each valid 30 second period throughout an 8 hour trading session, but not only is it very tedious (especially if trying to do it for numerous time frames) but it’s obviously very inefficient coding and was very resource hungry, slowing my computer down. If it wasn’t for the computer struggling I’d have persevered, but there seemed little point continuing if the end product (of my very inefficient coding) wasn’t going to be practical to use.
Many thanks in advance for reading this and any help would be greatly appreciated.
This indicator only generates a signal during the last 30 seconds of a bar. It works on any timeframe of 30 seconds or longer. The signal (1 for the last 30 seconds) can be incorporated into your own indicator…
Thanks for the code. Did not knew about the existence of TimeStamp and OpenTimeStamp…
I tried JS’s code in order to update arrays only at the end of the bar but it does not work for my problem…
Still having issues with arrays… Even if solution i found works for indicators, it seems the results are different in strategies (i don’t have the message “un paramètre de type enter positif est attendu avec”, but results are different in strategy/proorder than those in indicators/probuilder, with the same code…).
When i try to fix the code in proorder (with the code below), in order to get the same results than in probuilder, then i get the error message… (see picture)
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue