MTF Sequential Setup
Forums › ProRealTime English forum › ProOrder support › MTF Sequential Setup
- This topic has 48 replies, 8 voices, and was last updated 4 years ago by robertogozzi.
Tagged: mtf, Multiple Time Frames
-
-
08/31/2019 at 8:05 PM #10604009/01/2019 at 2:50 PM #106081
Hi Roberto, I wanted to use the above MTF code (Timeframe function) to test this as an indicator first before making it into a ProOrder/Backtesting program to see how it works before asking the program to execute the buys & sells. When asking to add the indicator with the multiple conditions to the chart, the programme brings up the syntax error message ” The keyword TIMEFRAME is only used for ProBacktest programming”.
I would just like to test how the multiple conditions based on the behaviour of indicators which are evaluated at different TFs behave prior to making orders and this is to ensure my code does what it is supposed to.
Do you know how one get around this issue?
Thanks
09/01/2019 at 3:08 PM #106083TIMEFRAME is only allowed in ProOrder and ProScreener. If you want to test values then use GRAPH and GRAPHONPRICE in a strategy. If you don’t want it to trade then just use a dummy buy order that can never be met such as:
1buy at -close limit09/01/2019 at 4:57 PM #106098Thanks Vonasi,
so I was able to do this, but the results the graph showed were not as expected. My code does similar to the above code from Robert in that the buy/sell condition must be true when an indicator (ROC in my case) is below zero and falling under (a) the current default display TF e.g. 1 min AND (b) is below zero and falling when evaluated on a 5 min TF. I also have a few other conditions which I only need to be evaluated at default TF, only this particular condition uses an indicator based on two different time frames. I don’t know if it matters in what order I do the condition testing so as not to affect all other conditions which only need default TF. My code in simple terms is this:
12345678910111213myRSI = rsi[14](close)myROC = ROC[14](close)timeframe(5 minute, updateonclose) // set the 5 min interval calculation pointcondition1 = myROC < 0 AND myROC[0] < myROC[1] // to be done on a 5 min timeframe intervaltimeframe(default) // reset the time frame calculation window so everything below this line will be evaluated against the specified TF on the chartcondition2 = myRSI crosses under 30 // evaluated on the default chart time framecondition3 = myROC < 0 AND myROC[0] < myROC[1] // evaluated on the default chart time frameIF NOT ShortOnMarket AND condition1 AND condtion2 AND condition3 THENSELLSHORT 1 at MARKETENDIF09/01/2019 at 6:01 PM #10610109/01/2019 at 6:03 PM #106102You have declared the indicators myRSI and myROC only in the default timeframe. You need to declare them in each time frame.
1234567891011121314timeframe(5 minute, updateonclose)myRSI5 = rsi[14](close)myROC5 = ROC[14](close) // set the 5 min interval calculation pointcondition1 = myROC5 < 0 AND myROC5[0] < myROC5[1] // to be done on a 5 min timeframe intervaltimeframe(default)myRSI = rsi[14](close)myROC = ROC[14](close) // reset the time frame calculation window so everything below this line will be evaluated against the specified TF on the chartcondition2 = myRSI crosses under 30 // evaluated on the default chart time framecondition3 = myROC < 0 AND myROC[0] < myROC[1] // evaluated on the default chart time frameIF NOT ShortOnMarket AND condition1 AND condtion2 AND condition3 THENSELLSHORT 1 at MARKETENDIF09/01/2019 at 7:43 PM #106130Thanks for this Vonasi,
seems like this is working but not quite 100%. I was hoping the “myROC5[0] < myROC5[1]” part of the code to actually compare the ROC values off the 5 min interval. To illustrate with an example of what I mean; every minute all 3 conditions will be checked so if for example the check takes place at 11:17, then for condition1, I was hoping the code to look for the myROC variable from 11:15 (myROC5[0]) and 11:00 (myROC5[1]) since technically these are the nearest complete variables calculated on the 5 min interval that are closest to 11:17 (the latest myROC5 has another 3 min until it will be calculated). I tried changing the “updateonclose” to “default” but that doesn’t quite work either. I can also see that the code isn’t quite doing what I need as I am directly comparing the 1 min chart on which I am running this test to a 5 min chart which shows the ROC values and at 11:17 the 11:15 and 11:10 values should be used by the code for evaluation but they are not.
Does something need to be re-jigged with the code or is that how it is supposed to be?
09/01/2019 at 8:14 PM #10613609/01/2019 at 9:18 PM #106141Hey Vonasi, to be honest the code I am running is just what you helped me with above. I have just added the GRAPH myROC5 line at the end so that I can see how the myROC5 variable moves and I compare it to an ROC[14](close) indicator which I run on a separate 5 min chart. When the above code runs my understanding is that the “myROC5[0] < myROC5[1]” part of condition1 (line 4 in your reply) should return the myROC5[0] and myROC5[1] calculated on the 5 min interval so in the example I gave, if the calculation of the SELLSHORT entry (line 12 in your reply) takes place every minute, say for example 11:17, then the myROC5[0] value returned should be that of 11:15 as that is the nearest completed candle on the 5 min timeframe line (line 4) and for the myROC5[1] should be the 11:10 candle value. The code above is not returning the 11:15 and 11:10 myROC5 values however.
Does this makes sense? I do not know how else to describe it unless I have completely misunderstood what the timeframe feature does, but i think it should simply allow you to evaluate price movements at different resolution/time frames rather than using multiple different charts in my example here I am just running the ROC on a 1 min chart and then another on a 5 min, but when asking it to evaluate myROC5[0] < myROC5[1] it seems it doesnt compare the exact ROC values which the 5 min chart has computed.
09/01/2019 at 9:33 PM #10614609/01/2019 at 9:59 PM #10615009/01/2019 at 10:12 PM #106154Just attaching individual screen shots would be much easier than expecting others to download xlsx files and then open up Excel. Then even when I did download it the screenshots are incredibly cluttered with a million and one indicators so it is impossible to see what is actually relevant to what we are discussing. Could I politely suggest that if you want assistance then you try to make it as easy as possible for those trying to help rather than as difficult as possible! 🙂
09/01/2019 at 11:01 PM #106161OK Vonasi, without over complicating this query, let me put this to you in just 2 questions.
Referring to line 4 above of the code you helped me with “condition1 = myROC5 < 0 AND myROC5[0] < myROC5[1] ” which falls under the “timeframe(5 minute, updateonclose) ” code.
What should the “myROC5[0]” variable return from that part of the code? ” Will it be the latest ROC of the last 14 period 5 min candle closes? If “YES”, then given the 5 min candles are obviously calculated at every 5 mins interval (hh:00, hh:05, hh:10…. until hh:55), then what HH:MM close would you expect to see when the program checks this condition every 1 min (line 14), eg. when line 14 runs at say HH:17, then the “myROC5[0]” will be as of what time?
I appreciate your help – I am just trying to understand the logic.
09/01/2019 at 11:23 PM #106162Just add the following dummy strategy to your default timeframe chart and hopefully all will become clear.
1234567891011121314151617181920timeframe(5 minute, updateonclose)myRSI5u = rsi[14](close)myROC5u = ROC[14](close)timeframe(5 minute, default)myRSI5d = rsi[14](close)myROC5d = ROC[14](close)timeframe(default)myRSI = rsi[14](close)myROC = ROC[14](close)buy at -close limitgraph myRSI5u as "5m RSI updateonclose"graph myROC5u as "5m ROC updateonclose"graph myRSI5d as "5m RSI default"graph myROC5d as "5m ROC default"graph myRSI as "Default timeframe RSI"graph myROC as "Default timeframe ROC"09/01/2019 at 11:43 PM #106165If you look at the attached image which shows just the 5 minute RSI with default (black) and updateonclose (red) on a 1 minute chart. At the close of the 2339 candle both are updated but at the close of the 2340 candle only the default one is updated. The updateonclose one will not funnily enough update until the 5 minute candle has closed – that is why it is called ‘updateonclose’! So it will next update its value at the close of the 2344 candle.
-
AuthorPosts
Find exclusive trading pro-tools on