add snippet to breakout code
Forums › ProRealTime English forum › ProOrder support › add snippet to breakout code
- This topic has 7 replies, 2 voices, and was last updated 1 year ago by robertogozzi.
Viewing 8 posts - 1 through 8 (of 8 total)
-
-
05/26/2022 at 10:40 PM #193911
Ive got much appreciated help from Roberto coding a DJ open-breakout strategy. I would like to get some help adding US daylight savings time or EU summer/winter time snippet code to this strategy.
DJ open12345678910111213141516171819202122232425262728293031323334353637383940414243DEFPARAM CumulateOrders = FALSEIF Not OnMarket THENMyExit = 0ELSEc1 = 0ENDIF// ADR Average Daily RangeMyADR = average[20,0](Dhigh(1) - Dlow(1))//IF (Time = 000000) OR ((Time > 000000) AND (Time < Time[1])) THENMyHI = highMyLO = lowc1 = 0ENDIFIF Time <= 142900 THENMyHI = max(MyHI,high)MyLO = min(MyLO,low)MyRange = MyHI - MyLOc1 = ((MyRange / MyADR) * 100) < x //75ENDIFIF Time >= 142900 AND c1 THENBUY 0.2 Contract AT MyHI + y * pipsize STOPSELLSHORT 0.2 Contract AT MyLO - y * pipsize STOPSET TARGET pPROFIT PL //40SET STOP pLOSS SL //80ENDIFIF MyExit = 0 THENIF (LongOnMarket AND (close - TradePrice) >= t * pipsize) OR (ShortOnMarket AND (TradePrice - close) >= tS * pipsize) THEN //27.5 37.5MyExit = TradePriceENDIFENDIFIF MyExit > 0 THENSELL AT MyExit STOPEXITSHORT AT MyExit STOPENDIF//GraphOnPrice TradePrice coloured(0,0,255,255)//GraphOnPrice MyHI coloured(0,128,0,200)//GraphOnPrice MyLO coloured(255,0,0,255)//Graph close - TradePrice//Graph c1//Graph MyADR//Graph MyRangeIve found this US daylight savings code in MOD:
mod snippet12345678910111213141516171819202122// --------- US DAY LIGHT SAVINGS MONTHS ---------------- //mar = month = 3 // MONTH STARTnov = month = 11 // MONTH ENDIF (month > 3 AND month < 11) OR (mar AND day>14) OR (mar AND day-dayofweek>7) OR (nov AND day<=dayofweek AND day<7) THENUSDLS=010000ELSEUSDLS=0ENDIFonce shortStep = 0once openStrongLong = 0if not onmarket or (time <= 143000 - USDLS and time >= 210000 - USDLS) thenshortStep = 0openStrongLong = 0endif//detect strong direction for market openonce rangeOK = 50once tradeMin = 500IF (time >= 144000 - USDLS) AND (time <= 144000 + tradeMin - USDLS) THENopenStrongLong = close > open AND close - open > rangeOKENDIFI dont get it to work, since results are exactly the same.
05/28/2022 at 10:50 AM #194055I think this should the the correct snippet (for 2022):
12345678// --------- US DAY LIGHT SAVINGS MONTHS ---------------- //DSTstart = 20220313DSTend = 20221106IF OpenDate >= DSTstart AND OpenDate < DSTend THENUSDLS=010000ELSEUSDLS=0ENDIFyou’ll have to change it every year.
1 user thanked author for this post.
05/29/2022 at 7:23 PM #19413805/30/2022 at 11:37 AM #194179I think you should add USDLS, instead of subtracting it.
05/30/2022 at 4:09 PM #19420505/30/2022 at 7:15 PM #194219Instead of using “-“, I think “+” would be more apppropriate.
05/30/2022 at 9:24 PM #194225a12345678// --------- US DAY LIGHT SAVINGS MONTHS ---------------- //DSTstart = 20220313DSTend = 20221106IF OpenDate >= DSTstart AND OpenDate < DSTend THENUSDLS=010000ELSEUSDLS=0ENDIFbut there are no “-” in the code? sorry for not understanding
05/30/2022 at 10:36 PM #194226Line 20.
1 user thanked author for this post.
-
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)
Find exclusive trading pro-tools on
Similar topics: