Could you add the bb conditions?
@winnie37
add the following conditions in your code
bu= BollingerUp[20](close)
bd= BollingerDown[20](close)
ba= (bu+bd)/2
br= (bu–bd)
c5= ba<ba[1] or high > bu[1]
for long trades it doesn’t seem to be a good filter like with short trades. Further investigation as to be made to understand why.
Paul, great job with long trades.
Trading hours have a big impact on performances. I tweaked @vonasi indicator “most actives hours_v2” in order to validate the best trading hours.
For long trades the best results are between 14 to 21 or at night between 23 to 5 am
For short strades 10 to 14 is good but we can improve performance by opening trades earlier at 8 am. From 8 am to 14, performance only lowers at noon.
I joined 2 screen captures. The first one is a capture of @vonasi indicator. The second one allows to validate that performance is stable other time. I have 100k of data so the test are made since 2016.
I often use the optimiser for time using the code below, optimiser X and Y settings could be, for example … 000000 to 110000 in steps of 001500.
I ignore the no sense times like 047500 which would most likely be the same optimiser result as 046000 or 050000 anyway.
Longentry = Time > X and Time < Y
Just a thought / idea.
Thanks for this advice Grahal. To prevent nonsense time we can maybe change “time” by “hour”.
Could you post the lastest version with optimized hours? Thanks
AbzParticipant
Veteran
hello
tested this strategy on the new PRT11 they have more data. see attached screen
i tested the original code posted on the page 1 in this discussion
Hi team!
I tried to modifiy with optimized hours but not sure to abtain a better result.
@Magifina, you talk about long trades but in the V3 version, it seems there are only short trades. Do you confirm? Did you insert these part of the code on your own or did I miss something?
Thanks for this work guys!
Hi Gregg,
You are right. V3 only show short trades. You can add long trades by inverting short conditions. For the time range 11PM to 5AM or 2PM to 9PM works.
Thanks @Magifina for your reply. I agree it increases the results in a good way… But still a ratio less than 2.
Do you keep these DEFPARAM?
DEFPARAM FLATBEFORE = 100000
DEFPARAM FLATAFTER = 180000
And I will try to add a Trailing Stop or maybe a Breakeven to see if it can change something better.
Could you post the entire version (long&short)?
I took away all conditions because they only improve a little bit max drawdown. It allowed me to test the best time frames.
For short trades 66% of the pêrformance is between 13 to 14.
For long trades most of the performance is between 00 to 01 AM
DEFPARAM CUMULATEORDERS = false
//LONGS
if time = 230000 THEN
buy 1 contract at market
endif
if LongOnMarket and time=050000 then
sell at market
endif
//SHORTS
if time = 100000 THEN
sellshort 1 contract at market
endif
if ShortOnMarket and time=140000 then
exitshort at market
endif
Thanks @Magifina! Not very easy to find the right parameters… and I’m not confortable with the Walk Forward tool to test it.
@winnie37, I’m not sure to be the right person to give my version of the code because I’m new in the game but here it is:
//-------------------------------------------------------------------------
// Code principal : EURUSD 15M Morning Entry V3 SHORT & SELL
//-------------------------------------------------------------------------
DEFPARAM CUMULATEORDERS = false
DEFPARAM FLATBEFORE = 100000
DEFPARAM FLATAFTER = 180000
// REINVEST
//capital = 10000 + strategyprofit
//positionsize = (capital / 10000)*positionsize
positionsize = 1
if time=140000 then
level=highest[2](low)[1]
endif
bu= BollingerUp[20](close)
bd= BollingerDown[20](close)
ba= (bu+bd)/2
br= (bu-bd)
// SHORT
c1= close < dopen(0)
c3= level > max(dlow(1),dlow(2))
c4= (dclose(1)-dopen(1))/dopen(1)*100<0.65
c5= ba<ba[1] or high > bu[1]
if time<130000 then
if c1 and c3 and c4 and c5 THEN
sellshort positionsize contract at market
endif
endif
if time=141500 and low>bd then
exitshort at market
else
if time>141500 and low>bd and (br<br[1] and br[1]<br[2] and br[2]<br[3] and br[3]<br[4]) then
exitshort at market
endif
endif
// LONG
c1b= dopen(0) > dclose(1)
c2b= dopen(1) > high
if time>135900 and c1b and c2b THEN
buy positionsize contract at market
endif
if time = 210000 then
sell at market
endif
if time>225900 and c1b and c2b THEN
buy positionsize contract at market
endif
if time = 050000 then
sell at market
endif
// SL TP
SET STOP %LOSS 0.5
SET TARGET %profit 1.5
//graph pp
I tried to add a Breakeven code and also a Trailing stop but it doesn’t change results that much. I think it’s because of the very short time we are exposed (about 3 to 4h max).
I’m not very confident with the winrate and ratio… But I’m sure that Master rank like Paul, Nicolas, GraHal, Vonasi or Roberto will have better suggestions 🙂
PaulParticipant
Master
Hi folks,
Gregg that looks good, nice! You can set multiplier for the atr.
Here is a snippet to play with profit-targets
//alternative profit exit
pp=(positionperf*100)
once profitexit=3
once n = 200
once p = 50
once x = 1
atr=( n*averagetruerange[p])*x
if profitexit=1 then
if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
flag=0
endif
if pp>=atr then
flag=1
endif
if shortonmarket and flag=1 and open<bd then
exitshort at open stop
endif
if longonmarket and flag=1 and open>bu then
sell at open stop
endif
elsif profitexit=2 then
set target %profit atr
elsif profitexit=3 then
set target %profit 1.50
endif
edit it uses
bu=bollingerup[20](close)
bd=bollingerdown[20](close)
Hi the strategy performs poorly for recent few trades, does it have anything to do with Brexit? It seems to give a better sense of security with a tighter stoploss/trailing stop. Cheers