Breakout Strategy on the candle stick – please Help!!
Forums › ProRealTime English forum › ProBuilder support › Breakout Strategy on the candle stick – please Help!!
- This topic has 13 replies, 4 voices, and was last updated 6 years ago by robertogozzi.
-
-
02/12/2018 at 6:22 PM #62467
Hi Nicolas and all,
I have creates a simple breakout strategy.. which triggers on the 1 hour chart.. when the 3am candle stick closed it will put an buy stop order 10 pips above the highest high of that 3am candle.. please see below!!
it will only trigger if the next candle reach 10pips above the highs? but if 5th candle reach the buy stop order it wont trigger?? please if anyone can help get this sorted?
aslo how can i add a Stoploss 10pips below the low on the 3am candle??
please help!!
Breakout on the candle stick1234567891011121314151617181920DEFPARAM CumulateOrders = Falsetradingtime=(time >= 030000 and time <060000)// Timeframe : H1if time=030000 thenvalue=high// Conditions to enter long positionsIF NOT LongOnMarket AND tradingtime and value THENEntryPrice = (high) + (10* pipsize)BUY 1 CONTRACTS AT EntryPrice STOPENDIF// Stops and targets : Enter your protection stops and profit targets here// points based STOP LOSS and TRAILING STOP// initial STOP LOSSSET STOP pLOSS 50//set target of positions at 50 pointsSET TARGET PROFIT 50ENDIF02/12/2018 at 10:06 PM #62491Your condition is only true once. So the strategy will place a stop order that is always valid for one bar. If you want it to be active longer you have to repeat the order.
1 user thanked author for this post.
02/13/2018 at 9:47 AM #62529thanks but how can i repeat the order? and add a Stoploss 10pips below the low on the 3am candle??
02/13/2018 at 12:49 PM #62584Move ENDIF from line 20 to line 7.
02/13/2018 at 12:59 PM #62586I suggest this modified code
12345678910111213141516DEFPARAM CumulateOrders = Falsetradingtime=(time >= 030000 and time <060000)// Timeframe : H1if time=030000 thenvalue = highStopLoss = range + (10 * pipsize) //10 pips below LOWENDIF// Conditions to enter long positionsIF NOT LongOnMarket AND tradingtime and value THENBUY 1 CONTRACTS AT Value STOPSET STOP LOSS StopLossENDIF//set target of positions at 50 pointsSET TARGET pPROFIT 5002/13/2018 at 1:28 PM #62591hi Roberto,
Thanks once again for your attention! i have tried to change abit..
Entryprice should be 10 pips above the high of 3am candle and should work as a stop order lets say if 6 am candle goes higher and the entryprice should be still 10pips high of that 3 am candle high!!
12345678910111213141516171819DEFPARAM CumulateOrders = Falsetradingtime=(time >= 030000 and time <060000)// Timeframe : H1if time=030000 thenvalue = highStopLoss = range + (10 * pipsize) //10 pips below LOWEntryPrice = (high) + (10* pipsize)ENDIF// Conditions to enter long positionsIF NOT LongOnMarket AND tradingtime and value THENBUY 1 CONTRACTS AT EntryPrice STOPENDIFIF OnMarket THENSET STOP LOSS StopLossENDIF//set target of positions at 50 pointsSET TARGET pPROFIT 50 //or SET PROFIT 50 * pipsize10pip higher the high of 3am is the entry and 10pip below the low of 3am is stoploss!!
02/13/2018 at 1:30 PM #62592It should work!
02/13/2018 at 5:56 PM #62627seems like it give the Stoploss just the low of the candle.. i have change StopLoss = range + (20 * pipsize) which gives the right Stoploss!! it will enter perfect at the entryprice but it aslo get another two entries randomly.. not sure why?
please see pic below:
12345678910111213141516171819DEFPARAM CumulateOrders = Falsetradingtime=(time >= 030000 and time <060000)// Timeframe : H1if time=030000 thenvalue = highStopLoss = range + (20 * pipsize) //10 pips below LOWEntryPrice = (high) + (10* pipsize)ENDIF// Conditions to enter long positionsIF NOT LongOnMarket AND tradingtime and value THENBUY 1 CONTRACTS AT EntryPrice STOPENDIFIF OnMarket THENSET STOP LOSS StopLossENDIF//set target of positions at 50 pointsSET TARGET pPROFIT 50 //or SET PROFIT 50 * pipsize02/13/2018 at 6:13 PM #62636My fault, just change line 7 so that it reads
1StopLoss = high - (range + (20 * pipsize))this should work also with 10 pips offset, rather than 20.
02/15/2018 at 9:36 PM #62867Hi Roberto..
I have manage to get pretty much the right entry and the stoploss.. thanks. i have change the time period 3am to 9am to trigger..
so for this now i have added to go short if short triggered.. please if you be kind enough to check below code if its correct? i have attached pic on GBPUSD.. please if you can check this on GBPUSD would be great!!!
the idea is.. if long triggered the short order should cancel automatically and also if short triggered the long order should cancel.. is this possible??
123456789101112131415161718192021222324252627282930DEFPARAM CumulateOrders = Falsetradingtime=(time >= 030000 and time <=090000)// Timeframe : H1if time=030000 thenvalue = highvalue1 = lowEntryPrice = (high) + (10* pipsize)EntryPrice1 = (low) - (10 * pipsize)StopLoss = range + (20 * pipsize) //10 pips below LOWStopLoss1 = range + (20 * pipsize) //10 pips above HIGHENDIF// Conditions to enter long positionsIF NOT LongOnMarket AND tradingtime and value THENBUY 1 CONTRACTS AT EntryPrice STOPENDIFIF OnMarket THENSET STOP LOSS StopLossENDIF// Conditions to enter Short positionsIF NOT ShortOnMarket AND tradingtime and value1 THENSEllSHORT 1 CONTRACTS AT EntryPrice1 STOPENDIFIF OnMarket THENSET STOP LOSS StopLoss1ENDIF//set target of positions at 50 pointsSET TARGET pPROFIT 50 //or SET PROFIT 50 * pipsize02/19/2018 at 10:33 PM #6322102/20/2018 at 8:14 AM #6325202/20/2018 at 10:16 AM #63272ah ok!! if i remove the tradingtime will that mean.. it will trigger any time after 3am.. will it trigger only once either way? its seems like if it gets trigger to go long and the stop loss or the profit target hit with in 3am and 9am.. it will place another order to go long for some reason? any reason why?
02/20/2018 at 11:51 AM #63284ah ok!! if i remove the tradingtime will that mean.. it will trigger any time after 3am… will it trigger only once either way? its seems like if it gets trigger to go long and the stop loss or the profit target hit with in 3am and 9am.. it will place another order to go long for some reason? any reason why?
No, it will trigger at all time, after 3am and before 3am the following day, then new values will be assigned to variables.
It may be triggered either ways (and that may happen more than once either way) as long as the Entry prices are hit.If you only want to enter ONCE, no matter which direction, then you just have to clear VALUE and VALUE1 when OnMarket.
If, instead, you want to enter ONCE per direction, then you just have to clear VALUE when LongOnMarket and VALUE1 when ShortOnMarket.
But it may happen that the trade is opened and closed within the same candle… then you can only tell a trade had been entered by comparing STRATEGYPROFIT at each candlestick. If the two values are not identical, you may assume a trade has been entered and closed in one bar!
-
AuthorPosts
Find exclusive trading pro-tools on