[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/31/2018 at 9:36 AM #7714008/01/2018 at 4:03 PM #7734808/01/2018 at 4:12 PM #77352
Great to hear that a report has been dealt with, even better when the outcome is successful!
1 user thanked author for this post.
08/03/2018 at 4:19 PM #77486Hello,
I want to code in multi timframe. 3 UT = 15 minutes and 5 minutes to confirm the trend and 1 minute to take a position.
example AT SALE
The system is simple if in M15 and M5: the MM100, the MM200, the MM600 and the MM100 + the daily pivot point are below the price.
In 1 MINUTE the same conditions + the stochastic crosses down the 80.
However, I have error messages in my coding. Prorelatime does not know the variables “MM1000” and “downtrend”.
Thanks for your help.ICT12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849// PAS Cumul des positions désactivédefparam cumulateorders=false// Nbre d'unité à achetén=1MM100 = average[100,1]MM200= average [200,1]MM600= average [600,1]sto = Stochastic[11,5]PPJ= DHigh(1)+ DLow(1)+ Dopen(1) //Point pivot journalier// VENTE//time frame 15 minutesTIMEFRAME( 15 minutes, updateonclose)downtrend = SHORTONMARKET <mm100 AND shortonmarket <mm200 and shortonmarket <mm600 and shortonmarket < ppjbulltrend= SHORTONMARKET >mm100 AND shortonmarket >mm200 and shortonmarket >mm600 and shortonmarket > ppj//time frame 5 minutesTIMEFRAME( 5 minutes, updateonclose)downtrend = SHORTONMARKET <mm100 AND shortonmarket <mm200 and shortonmarket <mm600 and shortonmarket < ppjbulltrend= SHORTONMARKET >mm100 AND shortonmarket >mm200 and shortonmarket >mm600 and shortonmarket > ppj//time frame 1 minutes prise de position// VENTETIMEFRAME( default)if downtrend and SHORTONMARKET <mm100 AND shortonmarket <mm200 and shortonmarket <mm600 and shortonmarket < ppj and sto CROSSES UNDER 80 thensellshort n shares at marketendif// SORTIE VENTEif sto CROSSES OVER 20 thenexitshort at marketendif// ACHATTIMEFRAME( default)if bulltrend and SHORTONMARKET >mm100 AND shortonmarket >mm200 and shortonmarket >mm600 and shortonmarket > ppj and sto CROSSES over 20 thenbuy n shares at marketendif// SORTIE ACHATif sto CROSSES UNDER 80 thenSELL at marketendiF08/03/2018 at 4:53 PM #7749408/05/2018 at 1:45 AM #77565if you are using a 30 min or 15 min strategy and want to check the trailing stop on a 1 min basis , how to do that?
123456789101112131415161718192021222324252627282930313233343536373839404142434445////trailing stop functionTIMEFRAME(1minutes)trailingstart = 2 //trailing will start @trailinstart points profit 25trailingstep = 1 //trailing step to move the "stoploss" 30 21 & 9slDistance = 0.6 // <--- to compensate for SL distance reqs emposed by the dealer.//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//anage 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+slDistance THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsTIMEFRAME(1minutes)IF 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+slDistance THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsTIMEFRAME(1minutes)IF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIFset stop ploss 508/05/2018 at 5:49 AM #77568You are doing right, provided your current chart is set on the lowest TF you are using and all TF’s are multiple of the lowest one.
Lines 25 and 38 are not necessary; you need to write the keyword TIMEFRAME only when you want to use a different one from the previous.
08/05/2018 at 8:46 AM #77569This is how it should look – and then run your strategy on a 1 minute chart. If decisions are made further up in the code on conditions and values found on slower time frame charts such as the 15 and 5 that you mention then the code for those will need to be put under TIMEFRAME(15 minutes,default) etc (or updateonclose instead of default if you want on the fly values/conditions).
12345678910111213141516171819202122232425262728293031323334353637383940414243////trailing stop functionTIMEFRAME(default)trailingstart = 2 //trailing will start @trailinstart points profit 25trailingstep = 1 //trailing step to move the "stoploss" 30 21 & 9slDistance = 0.6 // <--- to compensate for SL distance reqs emposed by the dealer.//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//anage 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+slDistance 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+slDistance THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIFset stop ploss 508/05/2018 at 11:10 AM #7757108/05/2018 at 11:42 AM #77573Yes, the lower the TF used, the less data history you have!
08/05/2018 at 11:55 AM #77574I suggest using sort of a template like this:
123456789101112TIMEFRAME (Daily, updateonclose)//your daily conditionsTIMEFRAME (4 hours, updateonclose)//your 4-hour conditionsTIMEFRAME (1 hour, updateonclose)//your 1-hour conditionsTIMEFRAME (default)//your code to Enter/Exit trades//your stop loss codeyou develop and probacktest your strategy on a 1-hour TF, thus granting you more data. When you are ready to launch it, switch to a 1-minute chart and run it without backtesting (you could backtest it, but results would be much different!).
This way you do not need to change your code, since ProOrder will assign the current TF on the chart to DEFAULT timeframe, initially 1 hour to develop it, then 30 minutes, 1 minute or whatever (provided all TFs used are a multiple of the lowest one, you wouldn’t be allow, say 25 or 7 minutes).
5 users thanked author for this post.
08/08/2018 at 10:33 AM #77756Just updated the documentation with the new automatic trading specific TIMEFRAME instruction: TIMEFRAME (ProBacktest / ProOrder)
2 users thanked author for this post.
08/08/2018 at 2:05 PM #7776908/08/2018 at 2:10 PM #77770Yes of course. Just like the example I made in the documentation TIMEFRAME (ProBacktest / ProOrder) with a 1 hour strategy but with a position management made in the 1 minute timeframe.
08/08/2018 at 2:14 PM #77772 -
AuthorPosts
Find exclusive trading pro-tools on