Double Top bottom
Forums › ProRealTime English forum › ProOrder support › Double Top bottom
- This topic has 15 replies, 4 voices, and was last updated 1 year ago by JS.
-
-
05/18/2023 at 12:03 AM #2148671234567891011121314151617181920212223242526272829303132333435363738394041fractalP = 10 //fractal periodpercent = 0.030 //maximum percent change between the 2 pointsbarlimit = 100 //maximum bars between 2 points//fractalscp=fractalPif high[cp] >= highest[(cp)*2+1](high) then //new fractal high found$TOPy[lastset($TOPy)+1] = high[cp] //store fractal value$TOPx[lastset($TOPx)+1] = barindex[cp] //store fractal barindex//COND=Summation[fractalP](Close>$topy[i])=1endifif low[cp] <= lowest[(cp)*2+1](low) then //new fractal low found$BOTy[lastset($BOTy)+1] = low[cp] //store fractal value$BOTx[lastset($BOTx)+1] = barindex[cp] //stire fractal barindexendifif(islastbarupdate and isset($topy[0]) and isset($boty[0])) then//check points in a range of X percentfor i = 0 to lastset($TOPy) do //loop through the topsfor y = 0 to lastset($TOPy) do //check first top with other topschange=abs(($topy[y]-$topy[i])/$topy[i]) //percent range between the 2 topsbardiff=abs($TOPx[i]-$TOPx[y]) //how many bars between the 2 points?Dtop= change<=percent/100 and bardiff<barlimit and bardiff>=fractalP and $topx[i]<>$topx[y]nextnextfor i = 0 to lastset($BOTy) do //loop through the bottomsfor y = 0 to lastset($BOTy) do //check first bottom with other bottomschange=abs(($boty[y]-$boty[i])/$boty[i]) //percent range between the 2 bottomsbardiff=abs($botx[i]-$botx[y]) //how many bars between the 2 points?Dbot= change<=percent/100 and bardiff<barlimit and bardiff>=fractalP and $BOTx[i]<>$BOTx[y]nextnextendifif not LONGONMARKET and Dbot thenbuy 1 shares AT MARKETENDIFSet Stop loss 30Set Target profit 60
hello to all, I’ve got a simple request. I’m studying the double top-bottom made by Nicolas, I’m trying to make a strategy, just for study. I’d like to go long when the second bottom at the condition Dbot) is identified, and go short when the second top is identifed. Strategy I’ve tryed does not give any result. can someone give me a tip? thank’0s in advance
Alessio
05/18/2023 at 10:49 AM #214876Strategy I’ve tryed does not give any result
No result in backtest or in Live trading?
What Instrument, TF are you testing on?
05/18/2023 at 11:37 AM #21487905/18/2023 at 12:05 PM #21488405/18/2023 at 12:56 PM #214885Hi Grahal, did you find it? code is a little modified but it’s the same in the end. if you load the indicator, you can set it as it’s set in the strategy. I cannot explain why that condition does not work, I’ve graphed it and condition never shows.
05/18/2023 at 1:15 PM #214887I’ve graphed it and condition never shows.
My conclusion (maybe wrongly?) was that the coincident conditions (x AND y AND z etc) do not occur coincident with each other?
Also it is frustrating Algo to play with (for me) as, on less than Daily TF, it takes ages to run / optimise etc?
05/18/2023 at 1:32 PM #21488905/18/2023 at 2:08 PM #21489105/18/2023 at 2:14 PM #214892I guess. you can test with less candles.
I was down to 1k bars, but I still lost interest as it took so long … due to the arrays I would think?
05/18/2023 at 3:03 PM #21489405/18/2023 at 4:45 PM #214895It was quick on Daily but no results so I was trying 1 hour and 5 mins etc and optimising the variables … then it seemd like it had stalled! 🙂
Optimisation is executed remotely on the PRT servers, our PC do very little so we don’t need super fast PC.
05/22/2023 at 2:07 PM #21501505/22/2023 at 2:46 PM #215019Do you understand arrays enough to manipulate the code for better results? Are you able to state exactly what you want to be changed in the code you posted?
I think there are very few on here who can code arrays successfully?
Maybe choose a simpler Algo and start a separate Thread?
05/22/2023 at 3:41 PM #215024FWIW :
I tried the original code (it is an Indicator), and this works (as indicator indeed). But there it stops because it is wayyyyyy too slow to be workable.
Copying the code into the program itself does not help, except for that you can see that it won’t trade indeed. This is most probably because the trade points – as shown by the indicator – don’t fall on the bar-ends (the close of them) so while there would exist a moment that this coincides, in practice you can’t find his because 1000 bars already take 15 minutes to backtest over here and in these 1K bars (of 1 minute) the situation does not occur or it is too tedious to try a few things.The solution, in my view, would be to enumerate the arrays one time per backtest (Optimization Parameters combination), so all the array-filling work can be done one time only, instead of 1000 times for testing over 1000 bars (or 200,000 times for 200K bars). But there it stopped to be funny, and I quit this case.
I did not make screenshots, but they would tell that for the intention of this indicator – trade on the 2nd top etc. – it requires refinement. Read : there would be too many false alarms because the shapes / fractals are not always caught correctly. On the other hand, notice that Nicolas just used this for a rough “arrays” example, which was a nice job to begin with.
Now if someone could cause that arrays are being dealt with smarter by PRT (like 10,000 times more efficient), “we” could all try to work on the improvement of such a really working DT/DB indicator. This one really has a good base (says me 😉 ).
1 user thanked author for this post.
05/22/2023 at 4:22 PM #215026 -
AuthorPosts
Find exclusive trading pro-tools on