Yesterday High Low during specific time
Forums › ProRealTime English forum › ProOrder support › Yesterday High Low during specific time
- This topic has 5 replies, 3 voices, and was last updated 6 years ago by
stefou102.
-
-
06/13/2019 at 6:25 PM #100578
Hello,
Silly question but I can’t figure it out right now after a busy day.
I would like to introduce in a strategy the high and low of the previous day for an index such as the dowjones, but only during the cash market hours… It’s pretty easy to do it for an indicator, but I don’t know why this isn’t working in proorder.
1234if time >=153000 and time<=220000 and date=yesterday thenmyHigh=max(myHigh , high)myLow= min(myLow , low)endifAny idea why myHigh/myLow are undefined?
06/13/2019 at 6:41 PM #100579DATE can never equal YESTERDAY.
This might help:
https://www.prorealcode.com/topic/customized-trading-session/#post-99680
06/13/2019 at 7:31 PM #10058106/13/2019 at 10:00 PM #100591Vonasi, as you helped me, here is MAYBE your reward…
this was not the idea I had in mind a few hours back, but the results are not bad. Tested on Dow Jones 1min, on 200k. Unfortunately, not enough history to really know if this is profitable strategy. Maybe someone who has already access to V11 with millions of bars of history?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248DEFPARAM FlatAfter = 215900DEFPARAM cumulateorders=falseONCE positionsize=1// The 24th and 31th days of December will not be traded because market close before 7h45 PMIF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THENTradingDay = 0ELSETradingDay = 1ENDIFif intradaybarindex=0 thenLongtradecounter = 0Shorttradecounter = 0long=0short=0endif//to account for daylight hour change (to update every year)if (month=3 and day<31 and day>10) thenstarttime=143000endtime=210000elsestarttime=153000endtime=220000endiftradetime=time >=starttime+1500 and time < endtime and dayofweek<>0 and tradingdayif time = starttime thenop = openlo = lowhi = highendifif time = endtime then//lastop = oplasthi = hilastlo = lolastcl = closeendifif time >= starttime+100 and time < endtime thenhi = max(hi,high)lo = min(lo,low)endifmaxi=max(max(op,lastcl),lasthi)mini=min(min(op,lastcl),lastlo)if close crosses over maxi and time >= starttime+1500 and time < endtime thenlong=1endifif close crosses under mini and time >= starttime+1500 and time < endtime thenshort=1endifmyMA7=average[7](close)if tradetime and not onmarket thenif long=1 and myMA7[1]<myMA7[2] and myMA7>myMA7[1] and Longtradecounter < 1 thenbuy positionSize contracts at highest[5](high)+3*pointsize STOPendifif short=1 and myMA7[1]>myMA7[2] and myMA7<myMA7[1] and Shorttradecounter < 1 thensellshort positionSize contracts at lowest[5](low)-3*pointsize STOPendifendifgraph longtradecounterif longonmarket thenLongtradecounter=Longtradecounter+1endifif shortonmarket thenShorttradecounter=Shorttradecounter+1endif//if longonmarket and low=lastlo then//sell at low-3*pointsize STOP//endif////if shortonmarket and high=lasthi then//exitshort at high+3*pointsize STOP//endif//graphonprice lastcl//graphonprice op//graphonprice lasthienablets=1 // mettre à 1 pour activer le trailing stop, sinon 0ts1=0.15 //trailing stop qui commence une fois que ts1% est atteint, puis quand la perf atteint ts2+ts3, diminué à ts2, puis quand la perf=ts1+ts2, placé à ts3ts2=0.125ts3=0.10if enablets thenswitch =ts2+ts3switch2=ts1+ts2underlaying=100// underlaying security / index / forex// profittargets and stoploss have to match the lines// not to be optimized// 0.01 forex [i.e. gbpusd=0.01]// 1.00 securities [i.e. aapl=1 ;// 100.00 indexes [i.e. dax=100]// 100=xauusd// 100=cl us crudetrailingstop1 = (tradeprice(1)/100)*ts1trailingstop2 = (tradeprice(1)/100)*ts2trailingstop3 = (tradeprice(1)/100)*ts3if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenmaxprice1=0minprice1=closepriceexit1=0maxprice2=0minprice2=closepriceexit2=0maxprice3=0minprice3=closepriceexit3=0a1=0a2=0a3=0pp=0endifif onmarket thenpp=(positionperf*100)if pp>=ts1 thena1=1endifif pp>=switch thena2=1endifif pp>=switch2 thena3=1endifendif// setup longif longonmarket thenmaxprice1=max(maxprice1,high)maxprice2=max(maxprice2,high)maxprice3=max(maxprice3,high)if a1 thenif maxprice1-tradeprice(1)>=(trailingstop1)*pointsize thenpriceexit1=maxprice1-(trailingstop1/(underlaying/100))*pointsizeendifendifif a2 thenif maxprice2-tradeprice(1)>=(trailingstop2)*pointsize thenpriceexit2=maxprice2-(trailingstop2/(underlaying/100))*pointsizeendifendifif a3 thenif maxprice3-tradeprice(1)>=(trailingstop3)*pointsize thenpriceexit3=maxprice3-(trailingstop3/(underlaying/100))*pointsizeendifendifendif// setup shortif shortonmarket thenminprice1=min(minprice1,close)minprice2=min(minprice2,low)minprice3=min(minprice3,low)if a1 thenif tradeprice(1)-minprice1>=(trailingstop1)*pointsize thenpriceexit1=minprice1+(trailingstop1/(underlaying/100))*pointsizeendifendifif a2 thenif tradeprice(1)-minprice2>=(trailingstop2)*pointsize thenpriceexit2=minprice2+(trailingstop2/(underlaying/100))*pointsizeendifendifif a3 thenif tradeprice(1)-minprice3>=(trailingstop3)*pointsize thenpriceexit3=minprice3+(trailingstop3/(underlaying/100))*pointsizeendifendifendif// exit longif longonmarket thenif priceexit1>0 thensell at priceexit1 stopendifif priceexit2>0 thensell at priceexit2 stopendifif priceexit3>0 thensell at priceexit3 stopendifendif// exit shortif shortonmarket thenif priceexit1>0 thenexitshort at priceexit1 stopendifif priceexit2>0 thenexitshort at priceexit2 stopendifif priceexit3>0 thenexitshort at priceexit3 stopendifendifendif//displayts=0////if displayts and priceexit1<>0 then//graphonprice priceexit1 coloured(0,0,255,255) as "trailingstop1"//endif//if displayts and priceexit2<>0 then//graphonprice priceexit2 coloured(0,0,255,255) as "trailingstop2"//endif//if displayts and priceexit3<>0 then//graphonprice priceexit3 coloured(0,0,255,255) as "trailingstop3"//endif//SET TARGET %profit 0.12SET STOP %loss 0.506/14/2019 at 7:32 AM #100612Why not make a quick test on 1M bars with PRT v11? (Dow Jones index).
06/15/2019 at 5:19 PM #100760 -
AuthorPosts
Find exclusive trading pro-tools on