Storing the candle close price on differing TFs
Forums › ProRealTime English forum › ProOrder support › Storing the candle close price on differing TFs
- This topic has 14 replies, 4 voices, and was last updated 1 month ago by
LivJoJade.
-
-
09/25/2025 at 9:40 PM #251830
Hi
I’m interested in automated trading and have the attached indicator and proscreener to use, I believe the proscreener can be used to convert to an automated system.
The indicator delivers buy/sell signals for which the proscreener then searches, what I want to know is this. Say a buy signal is delivered on the 4hr, 2hr, 1hr or 30min can the candle close price be remembered irrespective of what timeframe it is delivered, I then search for a subsequent buy signal on the 10min, 5min, 2min or 1min. If the close price on the shorter timeframe is lower than the close price on the longer timeframe it is an entry opportunity and we automatically buy, if the close price is higher than the ‘remembered’ longer timeframe signal we abort unless already in a profitable trade and therefore constitutes an additional entry.
I hope that all makes sense and would appreciate any help forthcoming.
Chris
09/26/2025 at 8:55 AM #251837Hi. Here you have an example.
123456789101112131415// --- Higher timeframe signals (example on 4h) ---TIMEFRAME(4hour,updateonclose)signalH = CALL "the one"IF signalH = 1 THENhigherClose = CloseENDIF// --- Back to lower timeframe ---TIMEFRAME(5minute)signalL = CALL "the one"// Only take entry if close < higher timeframe closeIF signalL = 1 AND close < higherClose THENBUY 1 CONTRACT AT MARKETENDIF2 users thanked author for this post.
09/26/2025 at 10:17 PM #251872First of all Ivan, many thanks for your help.
From your reply and my very limited knowledge of coding I’ve written the attached WIP file, this for long positions only.
Long TFs are 4, 2, 1 hour and 30 minutes.
Shorter TFs are 10, 5, 2 and 1 minutes
You will see from the Grocery Outlet Holding Corp screenshot a long entry was given on the 30 minute TF (close 1567.5) with a subsequent long entry on the 2minute TF (close 1510), however no entry was highlighted on the probacktest when run. Is my code incorrect or may I have overlooked something?
Again, many thanks for your help.
Chris
09/28/2025 at 9:09 PM #251901UPDATE
Having worked on this code over the weekend I attach my latest update. My concern is that when using multiple TFs it appears they need to be multiples and in this example of 10,5,2 and 1 minute that has to be 1 minute, does that mean the code will only autotrade on the 1 minute chart. If so can I overcome that so that entries can be on either the 10,5,2 or 1 depending on what secondary shorter TF the signal is delivered.
Many thanks in anticipation.
09/29/2025 at 8:25 PM #25201009/29/2025 at 8:32 PM #25201110/01/2025 at 9:02 PM #25208410/02/2025 at 10:47 AM #252095What istrument is it?
I could only spot PAR on your pic, but none of the instruments tagged PAR that I found match that price levels.
10/02/2025 at 11:16 AM #25209810/02/2025 at 4:16 PM #252112Sorry, but I could only find a similar asset quoting around 38.1, instead of 3.76, so I assume it’s not the same, so I couldn’t verify your missing trade.
1 user thanked author for this post.
10/03/2025 at 5:18 PM #252142good afternoon Robert
If I can provide further information to hopefully you in assisting me.
On 25/9 at the close of the 16.00 candle (value 3995.5) a buy signal was delivered on the 30 min chart, subsequently a further buy signal was given on the 1/10 at the close of the 19.25 candle (value 3791.5). As you can see this close on the shorter TF is lower than that given on the longer TF and should have resulted in a long position.
I attach the indicator code, the probacktest / automated trading code for your purposes along with all the info I can find on the instrument.
par technology corporation stock – Search
As per usual, in anticipation I am most grateful for your help.
Chris.
10/04/2025 at 1:33 PM #252158That’s not a ProRealTime chart, how could you run your code?
1 user thanked author for this post.
10/04/2025 at 6:54 PM #252166Apologies Robert the PAR screenshot was to provide further information on the instrument (which you had difficulty locating) for which signals had been delivered, sorry for the confusion.
However, using the same indicators and the same 4,2,1 and 30min longer TFs and the shorter 10,5,2 and 1min shorter TFs signal were given on Friday, they are:
Instrument: AIG American Intl Grp Inc. Short signal (3/10/25) on 30min at 15:30 candle close (value 8021.5). Subsequent short signals (3/10/25) on 5min at 17:10 candle close (value 8106.5) and on 1min at 20:41 candle close (value 8136.5)
Instrument: Belden Inc. Long signal (29/9/25) on 30min at 17:00 candle close (value 12141). Subsequent long signals (3/10/25) both on 2min at 18:56 candle close (value 11876.5) and again at 20:50 candle close (value 11805)
All entries show as being triggered if one runs a probacktest on the shorter TFs but are not triggered on an automatic trading system generated by the same probacktest code.
Many thanks for your continued support Robert
10/05/2025 at 9:39 AM #252169Hi,
When I look at the code of the “Call” indicator “the one”, I notice that the conditions required to produce a positive (1) or negative (-1) signal are very specific, you need to meet ten (10) conditions to trigger either signal, which means it will occur relatively rarely…It’s therefore important that a signal is remembered until the opposite signal appears, in other words, a +1 signal should remain +1 until a (counter)signal of -1 is generated…
The signal should only have two possible values: +1 or -1…
This is where things go wrong, because line 6 in the code (Signal = 0) resets the signal every 5 minutes…
Remove line 6 (//Signal = 0) from the code of “the one” and try again…
the one123456789101112131415161718192021222324252627282930ind1 = BollingerDown[26](close)ind2 = BollingerUp[26](close)ind3 = RSI[14](close)ind4 = 70ind5 = 30//Signal = 0IF (close > close[1] and close > close[2] and close[1] < close[2] and close[2] > close[3])THENIF (ind3 > ind3[1] and ind3 < ind3[2] and ind3[1] < ind3[2] and ind3[2] > ind3[3]) THENIF ind3 > ind4 THENIF close > ind2 THENSignal = -1ENDIFENDIFENDIFENDIFIF (close < close[1] and close < close[2] and close[1] > close[2] and close[2] < close[3]) THENIF (ind3 < ind3[1] and ind3 > ind3[2] and ind3[1] > ind3[2] and ind3[2] < ind3[3])THENIF ind3 < ind5 THENIF close < ind1 THENSignal = 1ENDIFENDIFENDIFENDIFreturn Signal style(histogram)2 users thanked author for this post.
10/05/2025 at 9:00 PM #252179Good evening JS, many thanks for taking the time to help.
I have added your indicator code to the attached 2 min charts for the following example triggered on Friday afternoon.
Instrument: Belden Inc. Long signal (29/9/25) on 30min at 17:00 candle close (value 12141). Subsequent long signals (3/10/25) both on 2min at 18:56 candle close (value 11876.5) and again at 20:50 candle close (value 11805)
You will note from the probacktests that my code only allows entries when the value is 1 (18:56 and 20:50 close) where yours would have an entry on all candle closes until the indicator changes to -1, this unless I of course add the extra if “notlongonmarket”. Although in the example given the market has gone against it is not always the case a -1 will follow a 1 signal, one may wish to average up or down and would therefore need to revert to the 0 in order to trigger subsequent entries if a subsequent signal in the same direction is given prior to an exit signal.
I hope I’ve explained that correctly.
Many thanks for your time and expertise.
Chris
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on 