Breakout Strategy help with my code
Forums › ProRealTime English forum › ProOrder support › Breakout Strategy help with my code
- This topic has 4 replies, 2 voices, and was last updated 7 years ago by Nicolas.
Viewing 5 posts - 1 through 5 (of 5 total)
-
-
04/04/2017 at 9:41 PM #31048
Hello
looking for some help on the strategy below.
- upper is the highest price between 080000 and 090000
- enter short when price goes under “upper” but only if next bar closes under upper and high on this bar must also be below upper
- SL shoud be the amount of points between upper and lower in the timeframe 080000 – 090000
- profitt target shoud be lower from the time frame 080000 – 090000
- same goes for Long
- enter long when price goes under lower and next bar closes above lower and lowest of this bar is also above lowest.
- SL shoud be the amount of points between upper and lower in the timeframe 080000 – 090000
- profitt target shoud be upper from the time frame 080000 – 090000
12345678910111213141516171819202122232425262728293031323334353637383940414243444546DEFPARAM CumulateOrders = false // Cumulating positionsDEFPARAM PRELOADBARS = 1000DEFPARAM FLATAFTER = 220000IF Time = 080000 THENTradeCounter = 0ENDIF// Trading HoursIF (Time >= 090000 AND Time <= t1) and dayofweek<=5 then// or (Time >= 220000 AND Time <= 220100) and dayofweek=1 THEN //Tradetime=1elseTradetime=0endift1=220000//Settingsonce upper=0once lower=0// calculate upper and lowerendtime = 090000If Time = endtime thenupper=highest[12](high)lower=lowest[12](low)dif=round(abs((lower-upper)*pipsize*pointvalue))endif//looking for short positionentershort1 = close[1] > upperentershort2 = close crosses under upperentershort3 = close < upperif not onmarket and entershort1 and entershort2 and entershort3 thenfadeshort=1elsif onmarket thenfadeshort=0endifif not onmarket and tradecounter < 1 and tradetime and fadeshort thensellshort 5 contracts at marketTradeCounter = TradeCounter + 1endifset stop loss difset target profit lower04/05/2017 at 9:11 AM #31075Hi Abz, your code seems a bit “scrambled”, I think you did a lot of debugging and copy/paste 🙂
I changed a bit some of the lines and added some variables too (still only short position):
12345678910111213141516171819202122232425262728293031DEFPARAM CumulateOrders = false // Cumulating positionsDEFPARAM PRELOADBARS = 1000DEFPARAM FLATAFTER = 220000IF Time = 080000 THENTradeCounter = 0ENDIF// Trading Hourst1=220000tradetime=Time >= 090000 AND Time <= t1 and dayofweek<=5// calculate upper and lowerendtime = 090000If Time = endtime thenupper=highest[12](high)lower=lowest[12](low)dif=upper-lowerendif//looking for short positionentershort= close[1] crosses under upper and high<upper and close<upperif not onmarket and tradecounter < 1 and tradetime and entershort thensellshort 5 contracts at markettp = close-lowerTradeCounter = TradeCounter + 1endifset stop loss difset target profit tpPlease consider that I did not test this code, please do your own tests, thank you.
04/05/2017 at 8:00 PM #31165Thanks Nicolas the code looks much better 🙂
for long will this work? i tried it and i dont get the entry points i am looking for.
12345678//looking for Long positionenterlong= close[1] crosses over lower and low>lower and close>lowerif not onmarket and tradecounter < 1 and tradetime and enterlong thenbuy 5 contracts at markettp = close-upperTradeCounter = TradeCounter + 1endif04/06/2017 at 11:10 PM #3130304/07/2017 at 8:40 AM #31326 -
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
Find exclusive trading pro-tools on
Similar topics: