Hey there,
I like the ProRealCode community very much – so many ideas and solved problems!
Now, this is my first post of a strategy I developed long ago, when I still worked with MetaStock. Programming in Prorealtime is much more comfortable. Im not a master-programmer but I like to share my idea here:
The idea is that after a bearish phase the market makes it often the other way round and we can cut a little piece out of this “swing back”. But the swing back has to reach a certain level. I know this is a kind of Fibo-Trading, but I divided the downtrend with help of the donchian channel into 4 sections. The first section is the bottom, the second and the third are in the middle and the fourth is the top.
When the market crosses from the first to second section we go long. Target could be the level from second to third section. Sometimes you can risk more… This is the variable “zl” in the code.
In addition to the first signal the standard macd has to show an upwards trend.
Also I added a very, very light progression in it. I know – things like martingale always lead to a catastrophe. But I think at certain winning rate it can “help” a little bit – its a limited progression. The progression can also be sharpened or smoothed with the “ff”-variable.
The starting ordersize “os” can be adapted to your account. An ordersize of 1 makes a drawdown of 293,- Euro, what is acceptable while gaining 3400,-. For me a draw down of 1/10 of the win is very acceptable. The maximum os is 7 in this case.
Increasing the ordersize to 3 makes a dd of 1022, while gaining 10600. Maximum os is 21.
Please feel free to change, prove and test the code….
Thanks for any responses….
Lotar
// Quadranten-System DAX 5 min // only long
defparam flatbefore=090000
defparam flatafter=173000
once os=3 // ordersize - can be any number depending on account size.
once osa=os
once kax=15 //15
once teilung=1.5 //1.5 reducing the ordersize after winning trade
once zl=2 // 2 Ziellevel. Quadrant wird in zl Teile geteilt, je weniger, desto höher das Ziel
once mgr=60 // 40 Mindestgröße des Channels
once ff=2.5 //2.5 increasing ordersize after losing trade.
once maxcon=ff*ff*os+os// defing the maximum ordersize
if hour=8 and minute>45 then // default setting of parameters outside tradingtime
if strategyprofit>sp then // and if equity reaches maximum again.
os=osa
sp=strategyprofit
endif
start=0
endif
if date<>20161226 and date <>20161227 and date<>20161230 and hour>8 then // there may be more "bad"-days to be excluded..... not only christmas
if strategyprofit<strategyprofit[1] then // increasing ordersize when losing
os=os*ff
if os>maxcon then
os=maxcon
endif
start=1
endif
if strategyprofit>strategyprofit[1] then // decreasing ordersize when winning
start=1
os=os/teilung
if os<osa then
os=osa
endif
endif
ma= macd[12,26,9] // standard....
if not onmarket and start=0 then // defining the trading channel (Donchian)
hh=highest[kax](high)
ll=lowest[kax](low)
diff=hh-ll // range of the channel
elonglinie=ll[1]+diff/4 // defining the entryline by dividing the channel into 4 Quadrants. Entryline is the first line above the bottom
// (above the lower band of donchian channel)
ziellong=ll[1]+diff/zl // defining the target line. zl: a variable to play with.....
elong=diff>mgr and close<elonglinie and ma[1]<ma// entry signal: minimum range of donchian, close below entry line and
///macd must move upwards.
if elong then
buy os contract at elonglinie stop //
endif
endif
sell at ziellong limit // target
sell at ll[1] stop // lower band of donchian = stop exit
endif