Help with simple breakout system multi timeframe

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #107508 quote
    Thally
    Participant
    Average

    Hi all,

    Im having some issues with a simple breakout system Im trying to code. The system works across 2 timeframes. We mark out the range of a 3 bar triangle on the daily and then trade the breakout on the H1.

    Ive written the code which marks out the range and that seems to work nicely using the graphonprice function. However, the system fails to buy/sell every close above/below the range.

    Can anyone spot what I’m doing wrong here?

    Thanks in advance

    Thally

    // Cumulating positions deactivated
    DEFPARAM CumulateOrders = False
     
    // money management
    ONCE Capital = 5000
    ONCE Risk = 0.01
    equity = Capital + StrategyProfit
    maxrisk = round(equity*Risk)
    
    // 3 bar triangle
    timeframe(daily, updateonclose)
    
    // Skip Sundays
    IF OpenDayOfWeek = 0 THEN
    myHigh = High[1] //store friday high if Sunday
    ELSE
    myHigh = High //else we store high
    ENDIF
    
    IF OpenDayOfWeek = 0 THEN
    myLow = Low[1] //store friday high if Sunday
    ELSE
    myLow = Low //else we store high
    ENDIF
    
    // Mark out triangle
    IF myHigh < myHigh[2] and myLow > myLow[2] THEN
    BOhigh = myHigh
    BOlow = myLow
    ENDIF
    
    graphonprice BOhigh COLOURED(100,149,237) AS "BOhigh"
    graphonprice BOlow COLOURED(100,149,237) AS "BOlow"
    
    timeframe(default)
    
    // Stoploss and position size
    StopLossL = abs(close - LOWEST[16](low))
    PositionSizeL = abs(round((maxrisk/StopLossL)/PointValue)*pipsize)
    StopLossS = abs(close - HIGHEST[16](high))
    PositionSizeS = abs(round((maxrisk/StopLossS)/PointValue)*pipsize)
    
    // Long
    IF Not ONMARKET AND close > BOhigh AND close[1] < BOhigh THEN
    BUY PositionSizeL PERPOINT AT MARKET
    SET STOP LOSS StopLossL
    ENDIF
    
    // short
    IF Not ONMARKET AND close < BOlow AND close[1] > BOlow  THEN
    SELLSHORT PositionSizeS PERPOINT AT MARKET
    SET STOP LOSS StopLossS
    ENDIF
    #107510 quote
    Thally
    Participant
    Average

    Even if I just stick to the daily timeframe rather than dropping down to H1, its still not taking trades as it should. See how it only takes one break of the blue lines when it should take each one unless already in a trade.

    Screen-Shot-2019-09-13-at-20.33.29.png Screen-Shot-2019-09-13-at-20.33.29.png
    #107513 quote
    Thally
    Participant
    Average

    Folks sorry for wasting your time. The issue was with the position size function and the starting capital. The rest of the logic works fine.

    #107519 quote
    GraHal
    Participant
    Master

    I’m please you have sorted it @Thally ,,, you can sleep better tonight also! 🙂

    #107531 quote
    Thally
    Participant
    Average

    Cheers mate. Worth having a play with the indicator, it does a nice job of marking out areas of consolidation before expansion. Have good weekend.

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

Help with simple breakout system multi timeframe


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Thally @rodger_dodger Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Thally
6 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/13/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...