Trend detection codes
Forums › ProRealTime English forum › ProOrder support › Trend detection codes
- This topic has 44 replies, 12 voices, and was last updated 3 years ago by
monkeys nuts.
-
-
02/16/2022 at 1:33 PM #188349
Interesting approach pableitor
Reminds me of an approach developed by Art Collins which identifies a “bias”. Create a variable called bias, if the first trend criteria is met then bias = bias + 1. For each trend criteria that is met then you add +1 to the bias variable.
Once bias exceeds a threshold, eg 5, the algo trades long or short
12345678910111213141516171819202122232425262728//Variables ParametersOnce Bias = 0//Creating Bias ScenariosIf Close>average[p,t] ThenBias = Bias +1EndIfIf Close>highest[50] ThenBias = Bias +1EndIfIf RSI[14] > 30 ThenBias = Bias +1EndIfIf Close>Open ThenBias = Bias +1EndIfIf Close>Close[1] and Close[1]>Close[2] and Close[2]>Close[3] ThenBias = Bias +1EndIf// Conditions to enter long positionsIf Bias>5 ThenBuy PositionSize CONTRACTS AT MARKETENDIF1 user thanked author for this post.
02/16/2022 at 2:34 PM #188352thanks for that, definitely worth playing around with.
To my mind it only makes sense with bias less than the total number of scenarios though, otherwise you might as well just add all the Bias Scenarios as conditions.
But if it could work with any 3 out of 5, for example, that could be a useful way of ‘accruing probability’.
They could conceivably be weighted, so that some counted more than others ???
02/16/2022 at 4:20 PM #188357I like your idea of weighting the different scenarios, will give that a try.
02/16/2022 at 5:19 PM #188358As already mentioned here, the perfect trend indicator does not exist. That’s why I try to determine the trend of the current market phase with relatively simple means and to use it. Sometimes the current market phase is only 10000bars long (TF M5), sometimes 50000bars. I can perhaps say I am optimizing today, others say you are lagging behind the market. If you re-optimize every few weeks. But for me this method seems to work quite well. If the result curve flattens out, it’s time to re-optimize. Maybe someday there will be a perfect trend over the last 10 years… but I don’t believe in it.
02/18/2022 at 9:13 AM #188439I think that the approach could be different: by identifying market phases (such as pullback, lateral movement, accumulation, distribution, ..) we don’t have to determine if the market is trending or not, because if we are not in one of that identified phase, then the price movement is sufficient to ride it to extract some money. It’s a bit like turning the problem upside down.
1 user thanked author for this post.
02/18/2022 at 9:52 AM #18845002/18/2022 at 12:18 PM #188458Sounds logical. But how would you implement that in the code to exclude the non-lucrative market phases?
That would be the 1 billion indicator !
02/18/2022 at 12:26 PM #18846102/18/2022 at 2:10 PM #18847002/18/2022 at 2:28 PM #188471here’s a short trend indicator that never fails:
123if opendayofweek = 5 and (Russia is about to invade Ukraine) thensell 1000 contracts at marketendif3 users thanked author for this post.
02/18/2022 at 2:31 PM #18847302/18/2022 at 2:37 PM #188475yeah, the coding for that bit in brackets needs some work … but you get the idea.
02/18/2022 at 2:54 PM #188476And how would you try? 😉
ok , I will give you the one and only trend indicator that will make you rich, it works 99.99% of the time 🤣 :
12345if pableitor is longonmarket thensell 1000 contractselsif pableitor is shortonmarket thenbuy 1000 contractsendif3 users thanked author for this post.
02/18/2022 at 2:59 PM #18847702/18/2022 at 3:24 PM #188479@pableitor, I know it feels that way sometimes – we’ve all been there!
-
AuthorPosts
Find exclusive trading pro-tools on