Popular Rule Based Model
Forums › ProRealTime English forum › ProBuilder support › Popular Rule Based Model
- This topic has 19 replies, 6 voices, and was last updated 6 years ago by ANDY.
-
-
04/12/2018 at 6:23 PM #68202
Dear Forum Members,
Dear Nicolas,a lot of institutional banking firms work with “rule bases investments”. the most popular in our bank is
the 200sma/38sma rule based strategy with a 3 % filter for noise.i wanna have this code for my own to use ist in pro realtime.
i wanna code this in weekly form, because i check the markets on weekends.description:
if the 8 week sma is over the upper band it is a long signal until the
the 8 week sma is under the lower band
a new long signal is formed when the 8 week sma is over the upper band again.my problem:
i cannot code the description until ….
please can you do this for me – in my indicator not i have no very time a histogramm
and the value is 0. that´s false – the logic is green or red and not 0.
do you understand what i mean.
please recode my code – that its correct 🙂thank you so much 🙂
here is my code:
popular rule based model1234567891011121314151617181920212223242526// orginial 200 day smac1 = average[40](close)// the 3 % up bandc2 = c1*1.03// the 3 % low bandc3 = c1*0.97// the original 38 day smac4 = average[8](close)//histogramm building// result1 is green// result2 is redif c4 > c2 thenresult1 = 1elseresult1 = 0endifif c4 < c3 thenresult2 = 1elseresult = 0endifreturn result1, result2, 004/12/2018 at 6:24 PM #6820404/12/2018 at 8:11 PM #68215Is this it?
1234567891011121314151617// orginial 200 day smac1 = average[40](close)// the 3 % up bandc2 = c1*1.03// the 3 % low bandc3 = c1*0.97// the original 38 day smac4 = average[8](close)if c4 > c2 thenresult = 1elsif c4 < c3 thenresult = -1endifreturn result, 01 user thanked author for this post.
04/12/2018 at 9:19 PM #68222Thanks Tempusfugit. I think you have solved Odin’s problem. I noticed that the moving average is a simple one while it’s an exponential one plotted on the chart.
So the strategy is as easy than looking for upper/ lower bands crossing with the 8 period MA?
04/13/2018 at 7:05 AM #6823304/13/2018 at 7:10 AM #68234So an easy Long Term system is
Buy 100 % when indicator value is one
And sell If the value is minus 1
No short Trades its only for long only Stock bias.
Ist should Work Well on sp500, nasdaq100 , stoxx600 and other really Big etfs Indexes to crate lazy wealth.
How should the Code Designed
A) Invest 100 %
B) invest 10.000 USD fix Dollar amount
Thx for Help
04/13/2018 at 7:12 AM #6823504/13/2018 at 7:13 AM #6823604/13/2018 at 8:56 AM #6824904/13/2018 at 11:17 AM #6825804/13/2018 at 5:37 PM #68291here you see, the rule bases modul is really powerful, for example for german tec dax etf.
now optimization and stop loss is required.
The Indicator of TempusFugit works well….
rule based trading system 40/8123456789101112131415161718// Festlegen der Code-ParameterDEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert// Bedingungen zum Einstieg in Long-Positionenindicator1, ignored = CALL "rule based modul"c1 = (indicator1 = 1)IF c1 THENBUY 10000 CASH AT MARKETENDIF// Bedingungen zum Ausstieg von Long-Positionenindicator2, ignored = CALL "rule based modul"c2 = (indicator2 = -1)IF c2 THENSELL AT MARKETENDIFcan you code this, that the trading system
everytime buys 100 % of all avaiable cash .. and reinvest 100 % .
thank you for help
04/13/2018 at 5:38 PM #6829504/13/2018 at 6:12 PM #68298and it is only long only
How come you show short trades in the Chart above?
I take it your Chart is not the result of your code … which does not show anY sellshorts?Seems a shame to not take advantage of the downs as well as the up periods??
04/13/2018 at 6:35 PM #68299you can use short trades… in bear phase i switch into high yield bonds etfs…
you can use it also as trend filter:
here it is a 2rsi trend model, every time buy when rsi2 is under 10
and sell on 10 % profit stop or wen rule based model would go short.
rbi rsi2 model1234567891011121314151617181920212223// Festlegen der Code-Parameter// Festlegen der Code-ParameterDEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert// Bedingungen zum Einstieg in Long-Positionenindicator1, ignored = CALL "rule based modul"c1 = (indicator1 = 1)indicator2 = RSI[2](close)c2 = (indicator2 < 10)IF c1 AND c2 THENBUY 10000 CASH AT MARKETENDIF// Bedingungen zum Ausstieg von Long-Positionenindicator3, ignored = CALL "rule based modul"c3 = (indicator3 = -1)IF c3 THENSELL AT MARKETENDIF// Stops und TargetsSET TARGET %PROFIT 1004/13/2018 at 6:38 PM #68302 -
AuthorPosts
Find exclusive trading pro-tools on