Breakout indicator

Forums ProRealTime English forum ProBuilder support Breakout indicator

Viewing 15 posts - 1 through 15 (of 19 total)
  • #55950

    A request that was addressed to ProRealTime:

    I wondered if you could help me put together a simple breakout indicator/autotrader as below? I’d like to use this programme to back test and auto trade various indices and forex markets, on various timeframes with variable £ per lot. I’m relatively new to Prorealtime and am actively trying to learn how to write programs, but info is a little sketchy so would appreciate your help with this 1st programme please. I’ll then hopefully be able to fathom out how the programme requirements in English translate to the syntax!

    Many thanks

    Breakout indicator

    Set time of candles to measure from and to – i.e. 16.00 to 22.00 This time needs to be adjustable to test various markets

    Measure highest and lowest points of that time period – this value is to be used as the target when trade entered – see below

    Buy/sell when candle closes above/below the highest/lowest points of measured period – ie measure highest and lowest candles for 16.00 to 22.00 and when next candle closes above or below enter trade.

    Stop loss equals the opposite high/low value – i.e. if enter long then s/l is the value of lowest measured point – if enter short the s/l is value of highest measured point

    Stop loss + “XX” pts – i.e. must be able to add “x” points to s/l for example, to set stop loss +5 pts to prevent being spiked out

    Take profit target is equal to value of high minus low of measured period

    Trading days/times and close time adjustable i.e. no trades taken after “xx:xx hrs” and all trades to be closed at “xx:xx hrs” trading days mon/tues/wed/thurs

    Buy/sell at £x per point – this value should be adjustable

    Suggestion for an anwser:

     

    1 user thanked author for this post.
    #56112

    Thanks for your response. However, I have tried to run the programme and I doesn’t seem to work correctly. If I can give you an example:

    GBP/NZD 1HR chart on Friday 15th December. If I ask the programme to measure the highest and lowest price from 00:00 to 04:00 then the highest price should be at 00:00 19239.5 and the lowest at 04:00 19129.5. The next candle to close above/below these levels was the close of the 07:00 candle at 19129.4. This is where a sell trade should have been entered at the open of the 08:00 candle with the stop loss the highest point i.e. 19239.5.

    However, when I run the above example using the programme you have written, it seems to enter a random sell entry at 06:00 a second sell entry at 13:00 which is clearly incorrect as the system should only take a maximum of 1 trade per day which should be at the close of the of the 07:00/open of the 08:00 candle .

    Could you please check and compare with my results?

    #56120

    Hi Andy, it is not me that coded this strategy, but just to be sure, are you testing it on a small timeframe? (an intraday one).

    #56130

    Hi Nicolas

    Yes – I’m typically measuring anything between 5minute and 1 hour charts for intraday trading.

    The programme above isn’t quite right – its making multiple spurious entries at random times – it should simply buy/sell the next candle after breakout

    Andy

     

     

    #56131

    I’ve been reading the programming code manual but am struggling to make sense of the order of the coding – i.e. the order of commands. Could you advise if there are there any online video resources that explain this? I’ve noticed there is a video for building indicators but cant find anything for how to create a programme?

    Any help/advise would be much appreciated

    Regards

    Andy

     

    #56279

    Getting closer but still not right!

    Here is the revised version of my breakout indicator from PRT – now correctly taking only 1 trade per day but still entering trades early – as soon as it touches the high/low levels – i.e. not waiting for bar to close above/below breakout levels before entering the trade at the open of the next bar. At the foot is my screen shot explanation to PRT…. can anyone help advise a fix for this?? I’d also like to be able to manually enter stop and take profit levels if possible…

    As a programming newbie, I’d very much appreciate a bit of assistance with this if anyone can spare a few minutes??

     

    begintime=000000
    endtime=040000
    XX=0

    if barindex=tradeindex or time=begintime then
    trading=0
    endif


    if time=endtime then
    trading=1
    endif

    if time=begintime or(time > begintime and time[1]<begintime) then
    myhigh=high
    mylow=low
    elsif time > begintime and time <= endtime then
    myhigh=max(high,myhigh)
    mylow=min(low,mylow)
    endif

    if not longonmarket and trading then
    buy 1 share at myhigh+1*pointsize stop
    sell at mylow+XX stop
    set target pprofit (myhigh-mylow)/pointsize
    endif

    if longonmarket then
    sell at mylow+XX stop
    endif

    if not shortonmarket and trading then
    sellshort 1 share at mylow-1*pointsize stop
    exitshort at mylow-XX stop
    set target pprofit (myhigh-mylow)/pointsize
    endif

    if shortonmarket then
    exitshort at mylow-XX stop
    endif
    ***********************
    Please note that you can change the period for measured highest and lowest points in the code’s part below:
    *****************
    begintime=000000
    endtime=040000
    XX=0
    *****************

    #56298

    andy6t6  see the little <> in the bar above?

    Using <> will insert your code all formatted so we can see and read it better and may get you more help?

    If nothing else it will keep Nicolas happy! 🙂

    GraHal

    1 user thanked author for this post.
    #56300

    Hi GraHal

    Thanks for your response – and the heads up! I’m new to the site and unfamiliar with protocol…but learning. Does this look better?

    Andy

     

     

    #56302

    Results attached 100,000 1 min bars @ Spread = 2

    Seems to do really well whilst market is choppy / ranging?

    Kinda ‘treads water’ during several week up / down trends?

    Andy … are you able to improve performance during trends?  Or have I screwed it up changing your XX value?? 🙂

     

    #56305

    Fantastic! Much appreciated.

    Looks quite good doesn’t it?…I felt sure I was on to something with this – just needed the programme for back testing to prove it.

    Don’t think you’ve done any harm changing the “XX” value – that was the reason I wanted it in there so stops can be extended to cope with those familiar spikes!

    I’ll have a play around with it over the next few days and share the results with you.

    One thing I have just noticed is that it is still taking trades half way up/down a candle instead of waiting for that candle to close and entering at the open of the next after price has broken out. (screen shot attached)

    Once again, thanks for you help with this.

    Andy

     

     

     

    #56307

    Yeah its entering part way thro a candle due to the Buy Stop Sell Stop levels?

    I’ve not deciphered your code but may get ‘more into it’ if it makes me some money tomoz! 🙂  Don’t worry, I’ll only run it if I’m at my desk watching it closely.

    It’s good to see a live trade unfold realtime! 🙂

    GraHal
    PS I guess you should make sure the code is working as you intended?  It’s possible that my optimising has simply ‘curve fitted’ to get a (good) result?

    For example … is below working correct, bearing in mind my version is a 1 min timeframe??  Sure you don’t need Highest / Lowest over x periods etc??

     

     

     

    #56309

    I planned to use it mainly on hourly to 5min charts – but that 1min dax looks good. Think I’ll give it shot tomoz to…..catch the end of the santa run hopefully!

     

    #56310

    Deleted! 🙂

     

     

     

    #56311

    yeah – well I think so! by entering the begin/end times x isn’t important (I didn’t think it was that is) – but there again I’m a complete newbie to syntax – I gave PRC the brief at the to of this thread and that’s what they came up with.

    Just had a quick look at the wall st……try  “XX”= 2,  begin 0700 end 1400,  100,000, 5min, used 2pt spread. Results attached.  I can see its going to be a late night!

    Be even better if we can get it to take the trade on the open of the next bar after breakout – otherwise, it gets caught with to many false breakouts.

    #56345

    Strat has opened a Buy Stop Order on the DAX at 13110 which is 1 point above the highest point reached between  times below. I can’t figure out how it is working as I was expecting the 16 points to feature somewhere!!? 🙂

     

     

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

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