[beta-testing] multi timeframe support for automatic trading, ideas are welcome!
Forums › ProRealTime English forum › ProOrder support › [beta-testing] multi timeframe support for automatic trading, ideas are welcome!
- This topic has 287 replies, 47 voices, and was last updated 4 years ago by Brianoshea.
Tagged: mtf, multitimeframe
-
-
07/25/2018 at 10:09 PM #76749
Indicators have always updated themselves on the fly, live, you’ll notice that looking at charts, especially on lower TFs, but you could only access them on closure of each bar.
Now you can access them while higher TFs are forming, this is by default. UPDATEONCLOSE will change this setting letting you access only values at the time of the last closed bar.
So referencing an MA on a daily chart from a 1-hour TF will return 24 different values. With UPDATEONCLOSE one value will be returned 24 times, that of the last close.
07/25/2018 at 10:21 PM #76750It’s only since MTF that the Daily Indicator code would run other than at close of the daily bar??
No – indicators have always shown the latest on the fly value and not been fixed at the close value until the candle has closed. Now with MTF we can decide whether to take this ever changing value or wait until the candle closes and just take the last closed candle value.
1 user thanked author for this post.
07/25/2018 at 10:39 PM #76751Think of MTF values for ‘updateonclose’ and ‘default’ as what you see if you apply this indicator to a chart in any time frame that would be a non default time frame. The default time frame will always be ‘updateonclose’.
1return close as "default", close[1] as "updateonclose"You will see that ‘default’ is ever changing while the candle is still forming and ‘updateonclose’ is fixed to the last candle close value.
1 user thanked author for this post.
07/25/2018 at 10:47 PM #76752Right I’ve got it now, thanks guys!
Rightly or wrongly (?) I think I’m going with default so I get the 24 values … to use Roberto’s example below! 🙂
robertogozzi wrote:
So referencing an MA on a daily chart from a 1-hour TF will return 24 different values.But I need to sleep on this and test it out more as somehow default feels like I’ll be using MTF in a way that is not being true to the higher TF. Maybe it doesn’t matter as values will be optimised for whichever method.
If for example using MACD on a higher 5 min TF (with the chart TF at 1 min) then as the MACD crosses over 0 / zero at 3 minutes into the 5 min bar them my (1 min) System opens a BUY then I might meet my target profit and exit by the time the true 5 minute / updateonclose Systems have waited the extra 2 minutes only to find that the MACD then drops back below 0 / zero! 🙂 🙂
07/26/2018 at 7:18 AM #76761There is no wrong or right. If looking at a monthly time frame value in your code then you might find that using ‘updateonclose’ is better as many will look at the last closed candle and say it was a down candle so that tells me a lot about market sentiment at the beginning of the month. However on the first of the month the new months currently forming ‘default’ candle will tell you nothing at all and so be pretty unusable for trading decisions – because for the first few days of the month it might be down and then up and then down – changing second by second before finally settling nearer the end of the month for whether it is likely to close up or down.
‘Default’ has the disadvantage of giving too many signals. If you are for example looking for a crossover in a five minute time frame then you could have dozens that whipsaw you in and out of a trade!
Maybe we should be looking at both values ‘updateonclose’ and ‘default’ and only trading if they are in agreement or disagreement depending on our strategy type? Now there is a new idea to test!
1 user thanked author for this post.
07/26/2018 at 1:49 PM #76800Like I wrote in my article: the code is still read only one time per bar, it has not changed!
And it is always the lower timeframe declared into your code that make this happen.
Example: if you have a 1 hour strategy, but you want to evaluate the code more often between two 1 hour bars to move your stoploss according to the price movement, then you can use the 5-minute TF to do it:
12345timeframe(1 hour,updateonclose)//the code of your strategytimeframe(default) // a lower timeframe than 1 hour//the code for your stoploss management07/26/2018 at 2:49 PM #76809The following helps to see what the difference is I think.
1234567891011121314timeframe(daily, updateonclose)closeave = average[2]timeframe(daily, default)defaultave = average[2]timeframe(default)if average[5] = -20 thenbuy at marketendifgraph closeave as "updateonclose"graph defaultave as "default"Applied on a 5 minute chart it can be clearly seen that the value of the ‘updateonclose’ changes just once at the beginning of a day and is held at that value throughout the whole day – resulting in a very squared off graph line. Where as the ‘default’ value changes every time a five minute bar closes.
07/29/2018 at 4:39 PM #77014I think that I might be falling in love with MTF!
I just used it in a ‘fake’ strategy that graphed median price over various time frames and I very quickly spotted a pattern. Within a couple of minutes I had turned it into the simplest of strategies and here are the results.
It is a daily long only strategy with just one variable and that is in a very general and simple bear market filter. The equity curve shown is for a level stake of 1 and spread of 2.4 on the DJI since the end of 1986. The average trade length is 1d 5h and 6d 7h between positions. The largest number of positions held was 8 and the longest trade was 15 days.
When you create something this simple and it works straight out of the box it is very satisfying. Hopefully it will work as well on some other indices. It happened to be named MySystem(123) so I think I might give it the strategy name of ‘Easy as 123’!
I am in love with MTF! Thank you PRT for giving it to us.
07/29/2018 at 5:22 PM #77020Hi,
So just to clarify, currently when you use the simplified creation tool and you set up a statement like SELL/BUY 10, they is a tab that says “Next Bar Open”
Is my understanding correct in saying that the new feature will now execute an order as soon as a condition is met(instantaneously) rather than waiting till the next bar/candlestick to open/appear ?
Kind Regards,
Simone
07/29/2018 at 5:39 PM #77026No, NEXTBAROPEN is ignored and is kept alive just to let old strategies run without errors.
MTF did not change this behaviour, code is still read when a bar CLOSES in the default (lowest) TF.
What is different now is that you may combine different TF’s (provided they are all multiple of the default one), so you can simulate opening a trade in any moment. If you deal with a Daily TF but use 1-minute as default, you’ll be able to open a trade any minute of the day referencing daily indicators and data, but only when the 1-minute bar closes!
07/29/2018 at 5:49 PM #77028No. I don’t think MTF is yet part of the simplified creation tool. That option ‘Next Bar Open’ is a bit of a redundant option as that is the only choice in PRT!
All trade decisions are made at the close of the bar in the time frame you are working in and so trades opened at the next bar open.
If you are manually writing a code then the chart time frame you are trading on is considered the ‘default’ time frame. With MTF you can now use values and conditions from slower time frames in your strategies decisions rather than just the values and conditions in the default time frame that you are trading in. These values and conditions can be either based on the last candle closed in the slower time frame or the current values/conditions at the close time of your candle in the default time frame. Slightly confusing but easy once you get the hang of it!
07/29/2018 at 5:50 PM #7702907/29/2018 at 6:17 PM #7703107/29/2018 at 6:32 PM #77033Vonasi,Roberto and Nicolas
Thanks for answering as I am a bit of a newbie to language and platform. Essentially I just want to ensure that when I automate orders they are done as soon as a condition is met rather than delayed to the close of the timeframe that I am using. So if you could provide some documentation or tips on this that would be great.
Regards
07/29/2018 at 6:49 PM #77034I just want to ensure that when I automate orders they are done as soon as a condition is met rather than delayed to the close of the timeframe that I am using
Everything is decided on the close of a candle. With MTF you could use a fast time frame and check your indicator in a slower time frame to achieve something similar but only with manual programming. The faster the time frame you use as default the less back testing data you will have available. MTF is not available for live trading yet
-
AuthorPosts
Find exclusive trading pro-tools on