Breakout Strategy on the candle stick – please Help!!

Forums ProRealTime English forum ProBuilder support Breakout Strategy on the candle stick – please Help!!

Viewing 15 posts - 1 through 15 (of 20 total)
  • #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!!

    #62491

    Your 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.
    #62529

    thanks but how can i repeat the order? and add a Stoploss 10pips below the low on the 3am candle??

    #62584

    Move ENDIF from line 20 to line 7.

    #62586

    I suggest this modified code

     

     

    #62591

    hi 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!!

    10pip higher the high of 3am is the entry and 10pip below the low of 3am is stoploss!!

     

     

    #62592

    It should work!

    #62627

    seems 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:

     

    #62636

    My fault, just change line 7 so that it reads

    this should work also with 10 pips offset, rather than 20.

    #62867

    Hi 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??

     

     

    #63221

    ?

     

    #63252

    It’s not possible to cancel pending order. Since they last only 1 period, the only way for them to get out from market is to wait 1 bar.

    #63272

    ah 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?

     

     

    #63284

    ah 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!

     

     

     

    #248873

    DEFPARAM CumulateOrders = False
    // Timeframe : H1
    tradingtime=(time >=090000 and time <=090000)
    if time=090000 then
    value2 = high
    value1 = low
    EntryPrice = (high) + (10* pipsize)
    EntryPrice1 = (low) – (10 * pipsize)
    StopLoss = range + (20 * pipsize) //10 pips below LOW
    StopLoss1 = range + (20 * pipsize) //10 pips above HIGH
    //takeprofit = range + (20 * pipsize) // TP LONG/SHORT

    ENDIF

    // Conditions to enter long positions
    IF NOT LongOnMarket AND tradingtime and value2 THEN
    BUY 0.5 CONTRACTS AT EntryPrice STOP
    ENDIF
    IF OnMarket THEN
    SET STOP LOSS StopLoss
    ENDIF

    // Conditions to enter Short positions
    IF NOT ShortOnMarket AND tradingtime and value1 THEN
    SEllSHORT 0.5 CONTRACTS AT EntryPrice1 STOP
    ENDIF
    IF OnMarket THEN
    SET STOP LOSS StopLoss1
    ENDIF

    // Stops and targets : Enter your protection stops and profit targets here
    // points based STOP LOSS and TRAILING STOP
    // initial STOP LOSS
    //set target of positions at 40 points
    SET TARGET PROFIT 200 //(”takeprofit” must be here if you want to achive 1:1 and remove below coding if not breakeven)
    //************************************************************************
    //trailing stop function
    trailingstart = 15 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the “stoploss”

    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF

    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF

    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF

    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************

    Hi

    Everyone this is a breakout strategy i was made with Nicolos and Robertos help massively. i’m still learning..

    I have added a trailing SL seems to be working fine. Is there a way that this can be developed in to have a take profit 1:2 or 1:3, meaning if the SL to entry had 30pips range target will be 60pips or 90pips?

    Please, can anyone have a look at this highly appreciated?

    Thank you in advance.

Viewing 15 posts - 1 through 15 (of 20 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login