Here is an Initial Balance Indicator V2.0 on a 5 min DAX chart. It measures high and low between 08:00 and 09:00 GMT+1. The strategy is to trade the faded breakout. Enter at high or low and ride toward the opposite side. You need to do the research on the best pips and SL for the strategy on various Instruments, but around 25-40 pips works very good.
//===========================================================
//5 min Time frame
//Initial Ballance indicator v2.0
//First Hour in the morning form 8:00-9:00 GMT+1 on DAX
//Observe pips between 25-40, trade faded breakout to opposite High/Low
//Kasper Elsborg @Elsborgtrading
//===========================================================
defparam drawonlastbaronly = false
once upper=0
once lower=0
starttime = 080000
endtime = 090000
If Time = endtime then
upper=highest[12](high)
lower=lowest[12](low)
dif=round(abs((lower-upper)*pipsize*pointvalue))
//bars=barindex
DRAWTEXT("#dif# pips", barindex-6, upper+10,SansSerif,bold, 16)
DRAWARROWDOWN (barindex-6,upper+5)
DRAWARROWup (barindex-6,upper+15)
DRAWTEXT("#upper#", barindex-6, upper,SansSerif,bold, 16)
DRAWTEXT("#lower#", barindex-6, lower,SansSerif,bold, 16)
endif
//if time >=080500 and Time <=090000 then
////backgroundcolor(0,255,255)
//DRAWRECTANGLE(barindex-6,upper,barindex-6,lower) COLOURED(0,255,0)
//endif
if time >=090500 and Time <=220000 then
count=count+1
DRAWsegment(barindex-count,upper,barindex,upper)coloured(0,0,0)
DRAWsegment(barindex-count,lower,barindex,lower)coloured(0,0,0)
else
count=0
endif
if intradaybarindex=0 then
hh = 0
ll = 0
alreadydrawn = 0
endif
if time=starttime then
startbar=barindex
endif
if time=endtime then
endbar=barindex
endif
if time>=starttime and time<=endtime then
if high>hh then
hh = high
endif
if low<ll or ll=0 then
ll = low
endif
endif
if time>endtime and alreadydrawn=0 then
drawrectangle(startbar,hh,endbar,ll) coloured(0,255,255)
alreadydrawn=1
endif
RETURN
You must be logged in to post a comment.
Hello, I noticed that the indicator shows the initial balance of today but also for all the previous days (a lot of line!!). Is it possible to draw only for the current day. I guess we need to add a condition like: "if day = today then...". What is the good synthax to do so? thx in advance
the indicator works on all instrument, question is if the strategy will work. You have to do you own research for this
upper=highest[6](high)//6 periods on a 10m min TF yield 1H
lower=lowest[6](low)//6 periods on a 10m min TF yield 1H
The indicator messure the high and low between 8:00 and 9:00 on a 5 min Timeframe. This is the initial ballance. 2nd code postet if on a 10 min tf. if you want another time frame you need to adjust the period of
short answer- you cannot :-)
Btw last code was a 10 min TF ver.
Sometime along the way since I coded the Indicator something has change in PRT- at least I think. The draw rectangle function is no longer drawn on the time defined- it's just drawn in all the chart- leaving it very un-useful. Also I experienced utterly low performance when scrolling in the chart so I made a quick fix. It seems to be less process consuming, and I change the draw rectangle with a simple background colour
//===========================================================
//5 min Time frame
//Initial Ballance indicator v2.0 10 min chart
//First Hour in the morning form 8:00-9:00 GMT+1 on DAX
//Observe pips between 25-40, trade faded breakout to opposite High/Low
//Kasper Elsborg @Elsborgtrading
//===========================================================
defparam drawonlastbaronly = false
once upper=0
once lower=0
starttime = 080500
endtime = 090000
If Time = endtime then
upper=highest[6](high)
lower=lowest[6](low)
dif=round(abs((lower-upper)*pipsize*pointvalue))
//bars=barindex
DRAWTEXT("#dif# pips", barindex-6, upper+10,SansSerif,bold, 16)
DRAWARROWDOWN (barindex-6,upper+5)
DRAWARROWup (barindex-6,upper+15)
DRAWTEXT("#upper#", barindex-6, upper,SansSerif,bold, 16)
DRAWTEXT("#lower#", barindex-6, lower,SansSerif,bold, 16)
endif
//if time >=080500 and Time <=090000 then
////backgroundcolor(0,255,255)
//DRAWRECTANGLE(barindex-6,upper,barindex-6,lower) COLOURED(0,255,0)
//endif
if time >=090500 and Time <=220000 then
count=count+1
DRAWsegment(barindex-count,upper,barindex,upper)coloured(0,0,0)
DRAWsegment(barindex-count,lower,barindex,lower)coloured(0,0,0)
else
count=0
endif
//
//if intradaybarindex=0 then
//hh = 0
//ll = 0
//alreadydrawn = 0
//endif
//
//if time=starttime then
//startbar=barindex
//endif
//
//if time=endtime then
//endbar=barindex
//endif
//
//if time>=starttime and time<=endtime then
//if high>hh then
//hh = high
//endif
//if low<ll or ll=0 then
//ll = low
//endif
//endif
//
//if time>endtime and alreadydrawn=0 then
//drawrectangle(startbar,hh,endbar,ll) coloured(0,255,255)
//alreadydrawn=1
//endif
if time >=starttime and Time <=endtime then
backgroundcolor(0,255,255)
endif
RETURN
I have moved the development topic https://www.prorealcode.com/topic/development-of-initial-ballance-automated-strategy/#post-30176
//===========================================================
//5 min Time frame
//Inital balance shortV1.0
//First Hour in the morning form 8:00-9:00 GMT+1 on DAX
//
//Kasper Elsborg @Elsborgtrading
//===========================================================
//==================DAX Daily Timeframe==========================
// Definition of code parameters
DEFPARAM CumulateOrders = false // Cumulating positions
DEFPARAM PRELOADBARS = 100
//==========================tradeingtime=========================
IF (Time >= 090000 AND Time <= t1) and dayofweek<=5 then// or (Time >= 220000 AND Time <= 220100) and dayofweek=1 THEN //
Tradetime=1
else
Tradetime=0
endif
//===============================================================
//REM Money Management
Reinvest=0
if reinvest then
Capital = 2000
Risk = 1//0.1//in % pr position
StopLoss = 4//7//10 // Could be our variable X
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*(Risk/100))
MAXpositionsize=5000
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)/PointValue)*pipsize)))
else
Capital = 2000
Positionsize=1
StopLoss = 4
equity = Capital + StrategyProfit
Endif
//===============Indicator
x1=stoploss
x2=1
x3=36
x4=-10
x5=2
t1=160000
once upper=0
once lower=0
//starttime = 080000
endtime = 090000
If Time = endtime then
upper=highest[12](high)
lower=lowest[12](low)
dif=round(abs((lower-upper)*pipsize*pointvalue))
endif
//fadebreakoutlow=lowest[3](low)<lower+10
enterhigh=close crosses under upper
If not onmarket and close >=upper-x2 then//and close>lower-x3 and tradetime then
fadehigh=1
elsif onmarket then
fadehigh=0
endif
once shorttrade=x5//2
if not tradetime then
shorttrade=x5//2
endif
//==========Enter market LONG
if dif<=x3 and fadehigh then
if not onmarket and Tradetime and enterhigh and shorttrade<>0 then
sellshort Positionsize CONTRACTS AT MARKET
shorttrade=shorttrade-1
ENDIF
endif
SET STOP loss x1
set target profit dif+(x4)
graph shorttrade COLOURED(0,0,0) AS "onetrade"
No I don't mind. Maybe together we can find a way. So this was my start. here only on short. Just keep in mind it zero bar trading and the tick by tick test will ruin the profit.
Hello Elsborg
thanks for a very nice indicator , i see you comment that you are trying to make an automated strategy but with no luck you say is that beacause of
i tried to make this automted but with no luck yet.
Hi Abz, well it was profitable until I used tick by tick backtest. I don't know if I will be able to make it a success
@Herves I didn't understand you before and was on my phone, so now I am on my Pc and I see what you mean. yes you are right it should be 080500. but it's only for the drawing part. the high and low are correct.
I'm not sure what to restrict? there is no drawing outside 0800 to 2200 ?
Previous period? The code states start @08:00 end @ 09:00 so unless you have changed your timezones or somerhing I cannot see how it is not drawn on that timeperiod. Starttime is becaus 8:05 is because start candle 8:00 closed 8:05. The draw is on close
Hi and thanks,
But on my chart, the drawrectangle was drawn on the previous periods, not only from 8am to 9am ..
Because you have to write line 13 : "starttime = 080500"
For information I am on CFD h24 with restriction on the schedules FUT 8h-22h
Do you know how to restrict the display to the current period ?
@+RV
Hi winnie.
I was attending a webinar for this strategy. The presenter had 5 min DAX data from 2009 and had it backtested to 80% winnings if pips was <40. But like all trading information you need to test it your self so currently I'm trying to make a automated strategy, but so far with no luck.
Bonjour, comment l'adapter sur 15 minutes au lieu de 1 heures ... j'ai changé 090000 par 081500 mais ca marche pas. Une idée ?