London Open Breakout

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #107067 quote
    othello
    Participant
    Senior

    This code, applied to the EurUsd with time frame H1, does not always produce the correct behavior.
    The logic of the operation should be well described by the comments in the code. If necessary, however, I am here to integrate the missing information.

    For example, on August 29th (candle at 7:00 pm) last, he makes a sale and a purchase, inside the same candle. But in the previous candle the conditions for entering the market were already false.
    Another example is that of last September 2nd (7:00 am candle): all three conditions are verified and in the next candle a sale should take place as there is a rupture of the lower end of the canal. But this does not happen.
    Can anyone help me understand?
    Thank you.

    Defparam cumulateorders = false
    
    // At 5 am I define the width of the canal (RangeBreakout) and its extremes (HH and LL)
    // Furthermore, I set the TradeLong and TradeShort variables to zero
    IF TIME = 050000 THEN
    HH = highest[8](high)
    LL = lowest[8](low)
    TradeLong = 0
    TradeShort = 0
    RangeBreakout = HH-LL
    ENDIF
    
    //I define the condition that requires working in a specific time interval
    Condtime = time >= 050000 AND time <= 180000
    // I define the condition that requires the closing price to be inside the channel
    Condchannel = close < HH and close > LL
    
    // If the Condchannel and CondTime conditions are met ...
    IF Condtime and Condchannel THEN
    IF TradeLong = 0 THEN
    buy at HH stop //... and if the system is not Long, then buy at the breaking of the upper end of the channel
    ELSIF TradeShort = 0 THEN
    sellshort at LL stop //... and if the system is not Short, then it sells at the breaking of the lower end of the channel
    ENDIF
    ENDIF
    
    // If the position is long, set the value of the TradeLong variable to 1
    IF longonmarket THEN
    TradeLong = 1
    ENDIF
    // If the position is short, set the value of the TradeShort variable to 1
    IF shortonmarket THEN
    TradeShort = 1
    ENDIF
    
    // Set a stop loss equal to the width of the channel
    set stop loss RangeBreakout
    // Set a profit equal to a percentage of the channel width
    set target profit RangeBreakout*Tgt
    
    graph Condtime
    graph Condchannel
    graph TradeLong
    graph TradeShort
    graph HH
    graph LL
    
    #107073 quote
    robertogozzi
    Moderator
    Master

    What is TGT?

    #107075 quote
    GraHal
    Participant
    Master

    Try below for Lines 20 to 25 (addition of not short / long onmarket)

    IF Condtime and Condchannel THEN
    IF not shortonmarket and TradeLong = 0 THEN
    buy at HH stop //... and if the system is not Long, then buy at the breaking of the upper end of the channel
    ELSIF not longonmarket and TradeShort = 0 THEN
    sellshort at LL stop //... and if the system is not Short, then it sells at the breaking of the lower end of the channel
    ENDIF
    ENDIF
    #107076 quote
    othello
    Participant
    Senior

    Tgt (Target) is a variable that in a first optimization I made vary between 0.1 and 5 with steps of 0.1.

    #107077 quote
    robertogozzi
    Moderator
    Master
    On Aug. 29th no trade entered (EurUsd, 1H). Are you sure about dates and times? Please attach scrrenshot to be able to see:

    – wrong trades

    – price

    – instrument

    – date

    – time

    #107078 quote
    othello
    Participant
    Senior
    Thanks GraHal, your fix won’t solve my problem. It has the merit, however, of having pointed out to me other errors in the code (one of these is that the width of the channel is modified during an operation).
    GraHal thanked this post
    #107079 quote
    othello
    Participant
    Senior
    You’re right, Roberto, and I thank you. For completeness I will do so next time. Now I focus on the error I identified thanks to GraHal’s intervention.
    #107080 quote
    GraHal
    Participant
    Master
    #107084 quote
    GraHal
    Participant
    Master
    In the version I provided .itf above, if you use below (instead of as in the .itf) then it gives a better equity curve? I had time >= 000000 in the .itf I provided.
    Condtime = time >= 030000
    Othello-3.jpg Othello-3.jpg
    #107120 quote
    othello
    Participant
    Senior
    I get attached at Spread = 4
    I thank you for the insights you gave me. It is really interesting to make the extremes that define the hourly trading interval vary. For the rest it seems to me a strategy on which there is still much to work. But aren’t 4 spread points excessive?
    #107135 quote
    GraHal
    Participant
    Master
    But aren’t 4 spread points excessive?
    On the DJI, spread is never lower than 1.6 and does go to around 4 between 23:00 and 01:30 so unless a System trades only during times when  spread = 1.6 then I use spread = 4.  Also there are overnight costs etc so spread = 4 for DJI goes some way towards  covering these also. I feel it is better to be a worst case re costs in Demo then maybe costs will be less and a pleasant surprise in Live trading! 🙂
    #107142 quote
    othello
    Participant
    Senior
    Yes, it is certainly a prudent and acceptable way to proceed. The only risk, in my opinion, (I think of other underlying assets) is to discard systems that could prove profitable. Thank you. 🙂
    #107160 quote
    Vonasi
    Moderator
    Master
    A good test is to remove spread altogether and then re-test the strategy several times slowly adding it back in up to an extreme value such as GraHal suggests. You should see a slowly decreasing performance as less trades get opened and spread hits profits more but your strategy should not break completely.
    #107163 quote
    othello
    Participant
    Senior
    It seems to me a good way to proceed but I have to try and try again several times: this phase of the process of building an automated trading strategy is still unclear to me. Thank you for your time.
    #107173 quote
    GraHal
    Participant
    Master
    (I think of other underlying assets) is to discard systems that could prove profitable
    I don’t use spread = 4 on all markets, for example on eurusd I use spread = 2 as eurusd is mostly spread = 0.6 during the day .
Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.

London Open Breakout


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
othello @othello Participant
Summary

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

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