MTF on stochastic
Forums › ProRealTime English forum › ProOrder support › MTF on stochastic
- This topic has 4 replies, 2 voices, and was last updated 5 months ago by Iván.
-
-
05/17/2024 at 2:36 PM #232768
Hi,
Need some help.
Let´s say i want to create a Multi timeframe strategy on two different timeframes with stochastic indicator or some other one like RSI, doesn´t matter which one.
Is the best way to create the indicator and include it in the strategy code or is it better/easier to use
the CALL instruction instead to “call” for the indicator?
If want a strategy like the one explained above on stochastic as an example on 1h and 15min so i better understand how things like this is coded in it´s simplest way.
And then use easy rules like this.
Long trades
1.Higher timeframe (1h) is bullish, stochastic (fast line is above slow) and not overbought (above80).
2. 15min timeframe, stochastic fast line crosses over slow line and is below oversold (below20) is when to buy.
Reverse for short ones.
If someone could code this I should be more then happy.
Thanks in advance!
05/20/2024 at 3:00 PM #232824Hi!
Here you have an example of long trades.
12345678910111213141516171819overbougth=80oversold=20timeframe(1h,updateonclose)stok1h=Stochastic[14,3](close)stod1h=Stochasticd[14,3,5](close)setupLong1h=stok1h>stod1h and stok1h<overbougthsetupShort1h=stok1h<stod1h and stok1h>oversoldtimeframe(15mn)stok15mn=Stochastic[14,3](close)stod15mn=Stochasticd[14,3,5](close)setupLong15mn=stok15mn crosses over stod15mn and stok15mn<oversoldsetupShort15mn=stok15mn crosses under stod15mn and stok15mn>overbougthif not onmarket and setupLong1h and setupLong15mn thenbuy 1 contract at marketset stop %loss 5set target %profit 5endif1 user thanked author for this post.
06/13/2024 at 10:17 AM #233834Thank you @Iván !
This make sens to me and works nice.
When i try the same approach but with an not predifined indicator like the DTOSC for example, coded by @doctrading in the indicator library. It will not read the overbought/oversold conditions correctly for me.
Here is a good example of what i was wondering before if it is easiest to code it as a separate indicator and then use the “call” command or to put the code for the indicator directly in the strategy code?
https://www.prorealcode.com/prorealtime-indicators/dtosc-dynamic-trader-oscillator/
07/05/2024 at 8:16 AM #234810Anyone?
I attached the code for the indicator.
DTOSC123456789101112131415161718192021222324252627282930313233343536373839type = 2if type = 1 thena = 8b = 5c = 3d = 3endifif type = 2 thena = 13b = 8c = 5d = 5endifif type = 3 thena = 21b = 13c = 8d = 8endifif type = 4 thena = 34b = 21c = 13d = 13endifstorsi = 100 * ((rsi[a] - lowest[b](rsi[a])) / ((highest[b](rsi[a])) - lowest[b](rsi[a])))dtosck = average[c](storsi)dtoscd = average[d](dtosck)Seuilhaut = 75Seuilbas = 25RETURN dtosck AS "DTOSCK" , dtoscd AS "DTOSCD" , Seuilhaut , Seuilbas07/05/2024 at 10:11 AM #234812Here you have an example:
123456789101112131415161718192021222324252627282930313233343536373839404142434445overbougth=75oversold=25type = 2if type = 1 thena = 8b = 5c = 3d = 3elsif type = 2 thena = 13b = 8c = 5d = 5elsif type = 3 thena = 21b = 13c = 8d = 8elsif type = 4 thena = 34b = 21c = 13d = 13endiftimeframe(1h,updateonclose)storsi1h = 100 * ((rsi[a] - lowest[b](rsi[a])) / ((highest[b](rsi[a])) - lowest[b](rsi[a])))stok1h = average[c](storsi1h)stod1h = average[d](stok1h)setupLong1h=stok1h>stod1h and stok1h<overbougthsetupShort1h=stok1h<stod1h and stok1h>oversoldtimeframe(15mn)storsi15mn = 100 * ((rsi[a] - lowest[b](rsi[a])) / ((highest[b](rsi[a])) - lowest[b](rsi[a])))stok15mn=average[c](storsi15mn)stod15mn=average[d](stok15mn)setupLong15mn=stok15mn crosses over stod15mn and stok15mn<oversoldsetupShort15mn=stok15mn crosses under stod15mn and stok15mn>overbougthif not onmarket and setupLong1h and setupLong15mn thenbuy 1 contract at marketset stop %loss 5set target %profit 5endif -
AuthorPosts
Find exclusive trading pro-tools on