*Code Attached: 160417-GH 3DayBullBear UKX 5M (v1.0)
Hello Fellow Traders
Attached – 3DayBullBear UKX 5M (v1.0)
Backtest results shown are Spreadbet (@ £1 per point) with a 2 point spread.
Please BackTest over 200K bars (I have max 100K bars) and post results on here. No / zero SellShort Trades trigger for me is this due to short conditions not met over my 100,000 bars??
Please code up improvements and post on here.
Cheers GraHal
*PS I’ll arrange (via Mods) for latest version code to be available in first post of Thread at all times (saves scrolling / reading pages to find latest improvements. Also a trial to see if version control can work on this site?).
//https://www.prorealcode.com/forum/prorealtime-english-forum/proorder-support/3-day-bull-bear/
//160417-GH 3DayBullBear UKX 5M (v1.0)
DEFPARAM CUMULATEORDERS = False
Threedaybull = dclose(1)>dopen(2) and dclose(2)>dopen(3)
Threedaybear = dclose(1)<dopen(2) and dclose(2)<dopen(3)
Currentdaybear = open[0]<((dhigh(1)-dlow(1))/2)
Currentdaybull = open[0]>((dhigh(1)-dlow(1))/2)
//Go Long
If Threedaybear and Currentdaybull and Close > Average[70](close) Then
Buy 1 contract at dhigh(1)stop
Endif
//Go Short
If Threedaybull and Currentdaybear and Close < Average[70](close) Then
Sellshort 1 contract at dlow(1)stop
Endif
//Exit Long (if 'going nowhere')
If Close < Average[200](close) and BarIndex - TradeIndex = 210 and Positionperf < 0 Then
Sell at Market
Endif
//Exit Short(if 'going nowhere')
If Close > Average[200](close) and BarIndex - TradeIndex = 210 and Positionperf < 0 Then
ExitShort at Market
Endif
//Stops and Targets
Set stop ploss 175
Set target pprofit 125
Good to get away from the screen and ‘have a think’ … above is flawed and that’s why there’s no Short Trades?
With my code
((dhigh(1)-dlow(1))/2)
I wanted mid-price but above will not give mid-price.
I’ll amend later, got to get ready for Easter Family Time!
GraHal
Code Attached: 170417 3DBullBear UKX 5M (v2)
(I’ll have to open Firefox to add code using Insert PRT Code button)
//https://www.prorealcode.com/topic/3-day-bull-bear/
//170417-GH 3DBullBear UKX 5M (v2.0)
DEFPARAM CUMULATEORDERS = False
Threedaybull = dclose(1)>dopen(2) and dclose(2)>dopen(3) and dclose(3)>dopen(4)
Threedaybear = dclose(1)<dopen(2) and dclose(2)<dopen(3) and dclose(3)<dopen(4)
Currentdaybear = dopen(0)<dclose(1)
Currentdaybull = dopen(0)>dclose(1)
//Go Long
If Threedaybear and Currentdaybull Then
Buy 1 contract at dopen(1)stop
Endif
//Go Short
If Threedaybull and Currentdaybear Then
Sellshort 1 contract at dopen(1)stop
Endif
//Stops and Targets
Set stop ploss 100
Set target pprofit 125
Now how do I get my V2 code at the top of the this Thread as I proposed in my first post?
I’m sure Nicolas is ‘all over this’ with a workable solution so I’ll leave it for now as I know he’s busy and I can’t direct message a Mod.
Maybe another button alongside ‘reply’ … add .itf file to 1st Post … if this could be done and then original posters / Thread Authors can be self-sufficient and add latest version code to their original Post??
GraHal
hey Grahal, you’ll find attached the 200k bars backtest. Not so bad, but surely overfit on last 100k ones I think? Added 1.5 point spread.
Thanks for all suggestions about forums improvements, I heard everything. Sometimes ideas are nice, but involved 1 or 2 days of dev, I think I’ll have to do them on spare time!
I agree Nicolas, ideas are easy … clever is he who makes them happen! 🙂
No dev time for you (you don’t need it!) and no hardship for us … another idea / suggestion below to make latest version code available on the first post of a Thread (voluntary basis).
Thread / Code Authors provide a link in the first post to a folder in their dropbox / google drive / similar where they store latest version code.
Discussions and code can be added as now to the thread at any point, but it would be up to thread originator to add latest version code to his dropbox / google drive.
I can put this on the ‘site suggestions thread’ if you wish, but to round off my ‘crazy ideas above’ 🙂 I added it here to close the loop.
Best Regards
GraHal