BB Trading one Long one Short on DAX 9-17,30
Forums › ProRealTime English forum › ProOrder support › BB Trading one Long one Short on DAX 9-17,30
- This topic has 2 replies, 2 voices, and was last updated 3 months ago by Iván.
-
-
08/14/2024 at 6:35 AM #236385
Hello,
i have build a programm which poorly didn’t work. Can someone help me?
It didn’t accept the filters from day before
It do more than one Trade in one direction
I use the Dax Future 9-1730
a) for the Filter of day candle
b) for creat the 5 minut BB
c) for Backtesting i take the one minute Chart and 1.000.000 candles
Here is the code with the explain of filter, stop etc.
Thank you very much
defparam preloadbars=5000
defparam cumulateorders=false
size=(100000+strategyprofit)/(close)*3//Trading Time for start
if time=>090000 and Time<124000 THEN
t=1
ELSE
t=0
ENDIF
//Parameter from Yesterday for Starting Conditions
Timeframe(daily)
//Range >0,6%
c101=(high-low)/close*100>0.6//Strong Cande with body of a minimum of 50%
if open>close then
c102=(open-close)/(high-low)>0.5
else
c102=(close-open)/(high-low)>0.5
endif//Use BB of 5 Min Chart
timeframe(5 minutes,updateonclose)
Bolld=ExponentialAverage[21](open)-2*std[21](open)
Bollu=ExponentialAverage[21](open)+2*std[21](open)// Only on Long Trade and one Short Trade a day
timeframe (5 minute)c1=(high[0]> BOLLU)
c2=(low[0]< BOLLD)
MaxTrades = 1
IF IntraDayBarIndex = 0 THEN
LongTally = 0
ShortTally = 0
Endifif not SHORTONMARKET and c1 and t=1 and ShortTally<Maxtrades then
SELLSHORT size contracts at market
ShortTally = ShortTally + 1
ENDIF//Close Position on 1730 when not SL or TP
if SHORTONMARKET and close<Average[21] or time>173000 THEN
EXITSHORT at market
ENDIF//Stop Conditions
if shortonmarket THEN
SET STOP LOSS AverageTrueRange[5](close)*2.0
ENDIFif not longONMARKET and c2 and t=1 and LongTally<MaxTrades THEN
buy size contracts roundedup AT MARKET
LongTally = LongTally + 1
ENDIFif longonmarket THEN
SET STOP LOSS -AverageTrueRange[5](close)*2.0
ENDIFif LONGONMARKET and close>Average[21] or time>173000 THEN
sell AT MARKET
ENDIF08/14/2024 at 6:59 AM #236386Code 9-1730 Dax Future one Minute BB Trading123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869defparam preloadbars=5000defparam cumulateorders=falsesize=(100000+strategyprofit)/(close)*3//Trading Time for startif time=>090000 and Time<124000 THENt=1ELSEt=0ENDIF//Parameter from Yesterday for Starting ConditionsTimeframe(daily)//Range >0,6%c101=(high-low)/close*100>0.6//Strong Cande with body of a minimum of 50%if open>close thenc102=(open-close)/(high-low)>0.5elsec102=(close-open)/(high-low)>0.5endif//Use BB of 5 Min Charttimeframe(5 minutes,updateonclose)Bolld=ExponentialAverage[21](open)-2*std[21](open)Bollu=ExponentialAverage[21](open)+2*std[21](open)// Only on Long Trade and one Short Trade a daytimeframe (5 minute)c1=(high[0]> BOLLU)c2=(low[0]< BOLLD)MaxTrades = 1IF IntraDayBarIndex = 0 THENLongTally = 0ShortTally = 0Endifif not SHORTONMARKET and c1 and t=1 and ShortTally<Maxtrades thenSELLSHORT size contracts at marketShortTally = ShortTally + 1ENDIF//Close Position on 1730 when not SL or TPif SHORTONMARKET and close<Average[21] or time>173000 THENEXITSHORT at marketENDIF//Stop Conditionsif shortonmarket THENSET STOP LOSS AverageTrueRange[5](close)*2.0ENDIFif not longONMARKET and c2 and t=1 and LongTally<MaxTrades THENbuy size contracts roundedup AT MARKETLongTally = LongTally + 1ENDIFif longonmarket THENSET STOP LOSS -AverageTrueRange[5](close)*2.0ENDIFif LONGONMARKET and close>Average[21] or time>173000 THENsell AT MARKETENDIF08/14/2024 at 12:43 PM #236397Hello!
I’ve slightly modified the code while keeping most of your original proposal. Now the system only makes one trade in each direction per day at most. Here is the code:1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465defparam preloadbars=5000defparam cumulateorders=falsesize=(100000+strategyprofit)/(close)*3//Trading Time for startif time=>090000 and Time<124000 THENt=1ELSEt=0ENDIF//Parameter from Yesterday for Starting ConditionsTimeframe(daily)//Range >0,6%c101=(high-low)/close*100>0.6//Strong Cande with body of a minimum of 50%if open>close thenc102=(open-close)/(high-low)>0.5elsec102=(close-open)/(high-low)>0.5endifdailyfilter=c101 and c102//Use BB of 5 Min Charttimeframe(5 minutes,updateonclose)Bolld=ExponentialAverage[21](open)-2*std[21](open)Bollu=ExponentialAverage[21](open)+2*std[21](open)// Only on Long Trade and one Short Trade a daytimeframe (5 minute)c1=(high[0]> BOLLU)c2=(low[0]< BOLLD)timeframe(default)MaxTrades = 1IF IntraDayBarIndex = 0 THENLongTally = 0ShortTally = 0Endifif not SHORTONMARKET and c1 and dailyfilter and t=1 and ShortTally<Maxtrades thenSELLSHORT size contracts at marketShortTally = ShortTally + 1ENDIFif SHORTONMARKET then//Stop ConditionsSET STOP LOSS AverageTrueRange[5](close)*2.0//Close Position on 1730 when not SL or TPif close<Average[21] or time>173000 THENEXITSHORT at marketENDIFendifif not longONMARKET and c2 and dailyfilter and t=1 and LongTally<MaxTrades THENbuy size contracts roundedup AT MARKETLongTally = LongTally + 1ENDIFif longonmarket THENSET STOP LOSS -AverageTrueRange[5](close)*2.0if close>Average[21] or time>173000 THENsell AT MARKETENDIFENDIF//graph LongTally coloured("green")//graph ShortTally coloured("red")1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on