MTF, with or without UPDATEONCLOSE?
Forums › ProRealTime English forum › ProOrder support › MTF, with or without UPDATEONCLOSE?
- This topic has 8 replies, 4 voices, and was last updated 1 year ago by GraHal.
-
-
06/03/2023 at 1:02 PM #215605
I would like to ask for your opinions here… When I use MTF, I use it in this form:
timeframe(240minute, updateonclose)
Now, more by accident, I omitted this “updateonclose” and my strategies somehow seem “rounder” with more power. The only way I can explain it is that the signal with “updateonclose” when used with an H4-TF comes 4 hours “later” and is valid for exactly 4 hours. If the signal is no longer available within these 4 hours, the system only notices it 4 hours later.
If I now set up a system without “updateonclose”, the system reacts almost immediately if a signal is present or not. That means it reacts faster… maybe more nervous?
Does anyone have experience with it? Can anyone give me their opinion on which is better? I’m a bit afraid of over-optimization…06/03/2023 at 2:50 PM #215606What is / are the other Timeframe(s) in your code?
If it were me I would updateonclose or not use updateonclose depending on which gives the ‘best’ results taking all performance factors into account?
Maybe if you post an equity curve with positions under equity curve and price curve under positions then we might be able advise somethng moe meaningful?
06/03/2023 at 3:23 PM #215607Hi phoentzs.
Omitting the ‘UPDATEONCLOSE’ is a shortcut, and is the same as replacing it with ‘DEFAULT’.
The difference between them is, ‘when’ the data covered by the ‘TIMEFRAME’ is updated.
‘UPDATEONCLOSE’ – uses the close of the specified timeframe.
‘DEFAULT’ – uses the close of the ‘Chart Timeframe’ , I guess could be known as ‘TIMEFRAME(DEFAULT,DEFAULT)’.
Using the ‘DEFAULT’ option, updates the ‘TIMEFRAME’ values at a higher frequency since the ‘TIMEFRAME’s time value is, and has to be a multiple of the default/chart timeframe.
e.g. if [ , ] was an update and chart 1h
updateonclose-v-default
8h …….,…….,-v-,,,,,,,,,,,,,,,,
4h …,…,…,…,-v-,,,,,,,,,,,,,,,,
1h ,,,,,,,,,,,,,,,,-v-,,,,,,,,,,,,,,,,
Regarding which is better – the best you can due is backtest both against each other based on what your doing. At least you will be able to see the differences between them and ‘Know’ which is better.
Regards
06/03/2023 at 3:39 PM #215608I don’t have a laptop here right now otherwise I could visualize it… I mostly use inputs in the TF M1 and get an overall trend from higher timeframes. This can be the M15 or the H4. If I remove UPDATEONCLOSE from an M15-TF, the system becomes very nervous and worse. But for systems that get signals from H1 or H4, removing UPDATEONCLOSE will make the system more powerful, with more positions and a quasi-similar drawdown. Which leads me to think that would be better in this case. I think there are just more opportunities for the M1-TF to take good positions. At least that’s what it looks like.
06/03/2023 at 3:41 PM #21560906/03/2023 at 4:47 PM #215614It’s a personal choice, whether to use signals while a candle is being formed or wait for its closing.
That’s what MTF is for, before that you could only wait for its closing, now you have a choice.
I prefer waiting the closing to enter a position and use the live data to confirm it. This code will enter on a SMA crossover, on a 4h-timefrane, provided on the Daily TF the SMA is currently rising. You may use it on a 4h-timeframe or lower:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657DEFPARAM CumulateOrders = False//Timeframe(Daily,default)SmaD = average[20,0](close)//Timeframe(4h,UpdateOnClose)Sma4 = average[20,0](close)IF (close CROSSES OVER Sma4) AND (SmaD > SmaD[1]) THENBUY AT MARKETSET TARGET pPROFIT 300SET STOP pLOSS 150ENDIF//Timeframe(default)//*********************************************************************************// https://www.prorealcode.com/blog/trading/complete-trailing-stop-code-function/// (lines 17- 56)////trailing stop functiontrailingstart = 10 //trailing will start @trailinstart points profittrailingstep = 1 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//*********************************************************************************06/04/2023 at 12:59 PM #21563006/22/2023 at 6:40 PM #21663306/22/2023 at 6:52 PM #216634I just did a test using Cursor Details, real easy to do, but best done while price is not moving (21:15 to 21:30 UK time on DJI).
I switched between TF’s – 1 min TF (MA1200) and 1 hour (MA20) – and value was the same (within the limitations of above error – 0.1 diff on DJI).
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on