strategy BarHunter DAX v1p
Forums › ProRealTime English forum › ProOrder support › strategy BarHunter DAX v1p
- This topic has 255 replies, 11 voices, and was last updated 1 year ago by sfl.
-
-
03/23/2020 at 11:58 PM #123076
BarHunter v4.5p 1h dax
1 user thanked author for this post.
03/23/2020 at 11:59 PM #12307903/24/2020 at 10:54 AM #123111Hi Paul, massive bedankt for all your work on this algo – looking good! Just to confirm, these all optimize @ 1h and run @ 1m — is that right?
And the key variables are the barnumber and the breakpointpercentage?
1 user thanked author for this post.
03/24/2020 at 8:58 PM #123198@nonetheless yes your correct. With exception of the oil-strategy which runs in backtest 1h and the same live.
Key variables are the ones you said. You can also finetune fifi743 pivot points.
1 user thanked author for this post.
03/27/2020 at 8:49 AM #123546Anyone else get a rejection on the SAF last night?
“Order level too close to the current market level. Minimum distance is 100 points.”
03/27/2020 at 12:58 PM #12359703/27/2020 at 5:59 PM #123633I don’t have it running in demo.
So I assume you guys have it on mode 0 on 1 minute right?
Couldn’t be the stoploss & profit target, since it’s at 2 %
So then it is the trailingstop. Since it’s on 1 minute, you can use cross over/under to exit on market.
1234567891011121314151617// trailing atr stop exits on low timeframeif longonmarket thenif newsl>0 thenif low crosses under newsl thensell at marketendif//sell at newsl stopendifendifif shortonmarket thenif newsl>0 thenif high crosses over newsl thenexitshort at marketendif//exitshort at newsl stopendifendif03/27/2020 at 6:33 PM #123637Oops, my bad — I’ve got mode = 1 on 1m. Duh…
Thanks Paul.
03/27/2020 at 8:07 PM #12364903/27/2020 at 8:48 PM #123656No, the positionsize I had right. And that would have given a different error message for the rejection. For me, i’m sure the problem was the mode. We’ll see if it happens again…
03/27/2020 at 9:38 PM #12365903/27/2020 at 9:48 PM #12366003/27/2020 at 11:10 PM #12366303/28/2020 at 1:21 PM #123706Thanks Francesco and Grahal, tbh I hadn’t checked the spread or the margin – just seemed like a good idea. On second thoughts…
As for indices ‘down under’ I’m getting interested in the ASX. Small spread, good margin rate but almost no one codes for it. With such a large mining sector it must be a lively market. And I esp like the idea of an algo that works while I sleep!
3 users thanked author for this post.
04/02/2020 at 1:33 PM #124351On real account there are no rejections as in demo account for information. Before version 4.5 of PAUL, I launched V4.3 by optimizing the stop.
BarHunter v4.3pstop 230123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415//-------------------------------------------------------------------------// hoofd code : barhunter v4.3p mtf mod fifi//-------------------------------------------------------------------------// dax 1 hour timeframe// spread 4// fm (fifi43 mods)//germany //24 uur//01.15-08.00 = 4//08.00-09.00 = 2//09.00-17.30 = 1//17.30-22.00 = 2//22.00-01.15 = 5//wall street 24 uur $10 / $2//09.00-15.30 2,4//15.30-22.00 1,6//22.15-22.30 9,8//23.00-00.00 9,8//alle andere tijden 3,8defparam cumulateorders = falsedefparam preloadbars = 10000timeframe (default)once mode = 1 // use [1] for 1 hour timeframe, [0] for 1 minute timeframeonce tds = 3 // trend detection system off when optimising barnumbersonce closebeforeweekend = 0once securebeforeweekendprofit = 1// separate long/short or go bothonce longtrading =1once shorttrading =1once holiday =1// select which intradaybar should be analysed (depends on timeframe settings)once barnumberlong =3 //long (timezone dependent)once barnumbershort=3 //short (timezone dependent)// select the number of points above/below the breakvaluelong/shortonce breakpoint=5// resetif intradaybarindex=0 thentradecounter=0tradeday=1endif// holidayif holiday thenif (month = 5 and day = 1) or (month = 12 and day >=15) thentradeday=0elsetradeday=1endifendif//timeframe (1 hour,updateonclose)if intradaybarindex=0 thenbreakvaluelong=99999breakvalueshort=0endifif longtrading or (longtrading and shorttrading) thenif intradaybarindex=barnumberlong thenbreakvaluelong=highendifendifif shorttrading or (longtrading and shorttrading) thenif intradaybarindex=barnumbershort thenbreakvalueshort=lowendifendif// trend detection systemif tds=0 thentrendup=1trenddown=1elseif tds=1 thentrendup=(average[10](close)>average[10](close)[1])trenddown=(average[10](close)<average[10](close)[1])elseif tds=2 thenperiod= 3inner = 2*weightedaverage[round( period/2)](typicalprice)-weightedaverage[period](typicalprice)hull = weightedaverage[round(sqrt(period))](inner)trendup = hull > hull[1]trenddown = hull < hull[1]elseif tds=3 thenperiod= 2inner = 2*weightedaverage[round( period/2)](totalprice)-weightedaverage[period](totalprice)hull = weightedaverage[round(sqrt(period))](inner)trendup = hull > hull[1]trenddown = hull < hull[1]endifendifendifendif// point pivot hebdomadaireif dayofweek < dayofweek[1] thenweeklyhigh = prevweekhighweeklylow = prevweeklowweeklyclose = prevweekcloseprevweekhigh = highprevweeklow = lowweeklypivot = (weeklyhigh + weeklylow + weeklyclose) / 3endifprevweekhigh = max(prevweekhigh, high)prevweeklow = min(prevweeklow, low)prevweekclose = close// point pivot journalierif dayofweek = 1 thendayhigh = dhigh(2)daylow = dlow(2)dayclose = dclose(2)endifif dayofweek >=2 and dayofweek < 6 thendayhigh = dhigh(1)daylow = dlow(1)dayclose = dclose(1)endifpivot = (dayhigh + daylow + dayclose) / 3ecart=4ecartwp=5// conditionscondbuy=intradaybarindex = barnumberlongcondbuy=condbuy and trendupcondbuy=condbuy and (close>pivot or (close <pivot and (pivot-close)/pointsize >ecart))condbuy=condbuy and (close>weeklypivot or (close <weeklypivot and (weeklypivot-close)/pointsize >ecartwp))condsell=intradaybarindex = barnumbershortcondsell=condsell and trenddowncondsell=condsell and (close<pivot or (close>pivot and (close-pivot)/pointsize >ecart))condsell=condsell and (close<weeklypivot or (close>weeklypivot and (close-weeklypivot)/pointsize >ecartwp))timeframe (default)// entry criteriaif mode thenif tradeday and tradecounter < 1 thenif longtrading and condbuy thenbuy 1 contract at breakvaluelong+breakpoint stoptradecounter=tradecounter+1endifif shorttrading and condsell thensellshort 1 contract at breakvalueshort-breakpoint stoptradecounter=tradecounter+1endifendifelseif tradeday and tradecounter < 1 thenif longtrading and condbuy thenif high > breakvaluelong+breakpoint thenbuy 1 contract at markettradecounter=tradecounter+1endifendifif shorttrading and condsell thenif low < breakvalueshort-breakpoint thensellshort 1 contract at markettradecounter=tradecounter+1endifendifendifendiftimeframe (1 hour, updateonclose)// trailing atr stoponce trailingstoptype = 1 // trailing stop - 0 off, 1 ononce trailingstoplong = 4 // trailing stop atr relative distanceonce trailingstopshort = 4 // trailing stop atr relative distanceonce atrtrailingperiod = 14 // atr parameter valueonce minstop = 10 // minimum trailing stop distance// trailingstop//----------------------------------------------atrtrail = averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000trailingstartl = round(atrtrail*trailingstoplong)trailingstarts = round(atrtrail*trailingstopshort)if trailingstoptype = 1 thentgl =trailingstartltgs=trailingstartsif not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenmaxprice = 0minprice = closenewsl = 0endifif longonmarket thenmaxprice = max(maxprice,close)if maxprice-tradeprice(1)>=tgl*pointsize thenif maxprice-tradeprice(1)>=minstop thennewsl = maxprice-tgl*pointsizeelsenewsl = maxprice - minstop*pointsizeendifendifendifif shortonmarket thenminprice = min(minprice,close)if tradeprice(1)-minprice>=tgs*pointsize thenif tradeprice(1)-minprice>=minstop thennewsl = minprice+tgs*pointsizeelsenewsl = minprice + minstop*pointsizeendifendifendifendiftimeframe (default)if longonmarket thenif newsl>0 thensell at newsl stopendifendifif shortonmarket thenif newsl>0 thenexitshort at newsl stopendifendif//graphonprice newsl coloured(0,0,255,255) as "trailingstop atr"timeframe (1 hour, updateonclose)// mod fifi43once enabletsvir =0 //trailing atr stop virtualonce bna =0 //test de nombre de bar negative ajouter fifi743once afprsi =0 //ajouter fermeture des positions rsi et barindex-tradeindexonce bougiedoji =1 //once timeadjustablestoploss=0 //// ================trailing atr stop virtual==================if enabletsvir then//once stepsvir=0once minatrdistvir=0once atrtrailingperiodvir = 2 // atr parameteronce minstopvir = 10 // minimum distanceif barindex=tradeindex thentrailingstoplongvir = 5 // trailing stop atr distancetrailingstopshortvir = 5 // trailing stop atr distanceelseif longonmarket thenif newslvir>0 thenif trailingstoplongvir>minatrdistvir thenif newslvir>newslvir[1] thentrailingstoplongvir=trailingstoplongvirelsetrailingstoplongvir=trailingstoplongvir-stepsvirendifelsetrailingstoplongvir=minatrdistvirendifendifendifif shortonmarket thenif newslvir>0 thenif trailingstopshortvir>minatrdistvir thenif newslvir<newslvir[1] thentrailingstopshortvir=trailingstopshortvirelsetrailingstopshortvir=trailingstopshortvir-stepsvirendifelsetrailingstopshortvir=minatrdistvirendifendifendifendif//atrtrailvir=averagetruerange[atrtrailingperiodvir]((close/10)*pipsize)/1000trailingstartlvir=round(atrtrailvir*trailingstoplongvir)trailingstartsvir=round(atrtrailvir*trailingstopshortvir)tglvir=trailingstartlvirtgsvir=trailingstartsvir//if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenmaxpricevir=0minpricevir=closenewslvir=0endif//if longonmarket thenmaxpricevir=max(maxpricevir,close)if maxpricevir-tradeprice(1)>=tglvir*pointsize thenif maxpricevir-tradeprice(1)>=minstopvir thennewslvir=maxpricevir-tglvir*pointsizeelsenewslvir=maxpricevir-minstopvir*pointsizeendifendifendif//if shortonmarket thenminpricevir=min(minpricevir,close)if tradeprice(1)-minpricevir>=tgsvir*pointsize thenif tradeprice(1)-minpricevir>=minstopvir thennewslvir=minpricevir+tgsvir*pointsizeelsenewslvir=minpricevir+minstopvir*pointsizeendifendifendif//if longonmarket and close <newslvir and newslvir>0 thensell at marketendifif shortonmarket and close>newslvir and newslvir>0 thenexitshort at marketendif//graphonprice newsl coloured(0,0,255,255) as "trailingstop atr"endif// test de nombre de bar negative ajouter fifi743if bna thenif longonmarket and barindex-tradeindex>138 and close<positionprice thensell at marketendifif shortonmarket and barindex-tradeindex>11 and close>positionprice thenexitshort at marketendifendif//=============== ajouter fermeture des positions rsi et barindex-tradeindex =====if afprsi thenmyrsi=rsi[15](close)//34if myrsi<47 and barindex-tradeindex>3 and longonmarket and close>positionprice thensell at marketendifif myrsi>69 and barindex-tradeindex>1 and shortonmarket and close<positionprice thenexitshort at marketendifendif// =================== forme de bougie doji ====================if bougiedoji thenif longonmarket and abs(open-close)<1 and high[1]<high and close>positionprice and high-close>18 thensell at marketendifif shortonmarket and abs(open-close)<1 and low[1]<low and close<positionprice thenexitshort at marketendifendif//==============================if timeadjustablestoploss thenif hour>6 and hour<18 thensl=160elsesl=270endifset stop ploss slelseset stop ploss 230endiftimeframe (default)if closebeforeweekend thenif onmarket thenif (dayofweek=5 and hour>=22) thensell at marketexitshort at marketendifendifendifif securebeforeweekendprofit thenif (dayofweek=5 and hour>=18) thenif longonmarket thenif close>positionprice+20 thensell at tradeprice(1)+10 stop//else//if hour>=22 then//sell at market//endifendifendifif shortonmarket thenif close<positionprice-20 thenexitshort at tradeprice(1)-10 stopelseif hour>=22 thenexitshort at marketendifendifendifendifendifset target %profit 1//graph barindex-tradeindex//graph intradaybarindex//graphonprice breakvaluelong//graphonprice breakvalueshort//graph breakvaluelong//graph breakvalueshort1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on