Range Breakout

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #40805 quote
    Maximillion07
    Participant
    New

    Hi guys,

    it seems to be very profitable to trade the breakout of the Asia session in gbpusd when all candles stay under the ema 63 for short or when all candles stay above the ema ( dont touch it ) for long. Sl at the other side of the range or 30 pips. This should show the backtest. 1hour chart!

    I am not able to program a fixed range from 0-7 h (so the first 8 candles of the day in 1h chart) and set the orders right.

    Can someone help me?

    Thank you!

    #40818 quote
    robertogozzi
    Moderator
    Master

    You may try this. I did not test it, so you are likely to have to make corrections, besides inserting your code to handle your strategy:

    DEFPARAM CumulateOrders     = False                                   //no more than 1 trade allowed
    DEFPARAM FlatAfter          = 235959                                  //Comment this out to keep trades running overnight
    
    ONCE StartBreak             = 000000                                  //Start of BreakOut strategy time, no trades
    ONCE EndBreak               = 070000                                  //End   of BreakOut strategy time, trades on
    ONCE NoMoreTrades           = 240000                                  //Time to stop entering new trades
    
    ONCE MinPrice               = 0                                       //Lowest  price (initial value)
    ONCE MaxPrice               = 0                                       //Highest price (initial value)
    
    IF (time >= StartBreak) AND (time <= EndBreak) THEN                   //Check at each bar
       IF close < MinPrice THEN                                           //Update minimun if a lower closing price is met
          MinPrice = close
       ENDIF
       IF close > MaxPrice THEN                                           //Update maximum if a higher closinfg price is met
          MaxPrice = close
       ENDIF
    ENDIF
    
    IF OnMarket THEN                                                      //Set variables to initial ZERO after entering a
       MinPrice = 0                                                       //   trade, so they are ready for the next break out
       MaxPrice = 0
    ENDIF
    
    IF (time >=  EndBreak) AND (time < NoMoreTrades) THEN
       .
       .                                                                  //you wanna put your orders here according to
       .                                                                  //  your conditions
       .
    ENDIF
    

     

    Hope this is what you were looking for.

    Roberto

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Range Breakout


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
8 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/16/2017
Status: Active
Attachments: No files
Logo Logo
Loading...