Can I buy at the high?

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #59150 quote
    paulon
    Participant
    Average

    Hi. I want to trade the major indices with the following condition.  Assume c1 is the condition for a long trade.  If c1, then enter a long trade if a following bar crosses over the high of the signal bar.  The entry level should be the high of the signal bar (not the next market open).  The order should be valid for x bars after the signal bar.  The profit limit is the close of the signal bar plus the ATR and the stop loss is the close of the signal bar minus the ATR.

    #59153 quote
    Inertia
    Participant
    Master

    Hi Paulon, as a start, check out this link :

    Customized Oscillator that take initial value the yesterday's highest/top price

    More experienced coder might jump in this tread soon 😉

    Thx

    paulon thanked this post
    #59154 quote
    Vonasi
    Moderator
    Master

    Yes. Just use:

    BUY ? Contracts AT High STOP
    SELL AT (close + AverageTrueRange[?]) LIMIT
    SELL AT (close - AverageTrueRange[?]) STOP

    Obviously replace the ? with your values. You will have to set these instructions at the close of every bar that you want the instruction to last for as they only last for one bar and are then cancelled.

    paulon thanked this post
    #59246 quote
    robertogozzi
    Moderator
    Master

    Hi. I want to trade the major indices with the following condition. Assume c1 is the condition for a long trade. If c1, then enter a long trade if a following bar crosses over the high of the signal bar. The entry level should be the high of the signal bar (not the next market open). The order should be valid for x bars after the signal bar. The profit limit is the close of the signal bar plus the ATR and the stop loss is the close of the signal bar minus the ATR.

    By no means you (and anyone else) may access future data. So you’ll have to modify your sentence to the past: “Assume c1[1] is the condition for a long trade, then enter a long trade if THIS bar crosses over the high of the signal (previous) bar. i.e. HIGH[1]”.

    mr blue thanked this post
    #59259 quote
    mr blue
    Participant
    Senior

    Thank you for sharing this idea.

    I see good results on the DAX 4h (with some adjustments of course).

    #59327 quote
    GraHal
    Participant
    Master

    Please could you share @mr blue? 

    I did have a play with the concept, but couldn’t get much out of it.

    #59336 quote
    mr blue
    Participant
    Senior

    I picked up the original idea, looked for a profitable timeframe on the DAX and added one additional condition, that the market must be “risk on” – otherwise it will not buy.

    defparam cumulateorders = false
    
    Ht = DHigh(1)
    Bs = DLow(1)
    C = DClose(1)
    
    Pivot = (Ht + Bs + C) / 3
    //Res4 = Pivot + ((Ht - Bs)*3)
    //Res3 = Pivot + ((Ht - Bs)*2)
    //Res2 = Pivot + Ht - Bs
    Res1 = (2 * Pivot) - Bs
    //Sup1 = (2 * Pivot) - Ht
    //Sup2 = Pivot - (Ht - Bs)
    //Sup3 = Pivot - ((Ht - Bs)*2)
    //Sup4 = Pivot - ((Ht - Bs)*3)
     
    if close > Res1  then
    
    BUY 1 Contracts AT High STOP
    SELL AT (close + AverageTrueRange[9]) LIMIT
    SELL AT (close - AverageTrueRange[9]) STOP
    
    endif
    

     

    Using this source version you get the following results backtested (profit chart RED) … of course I investigated a bit more in this approach and the current result of the – not yet shared code  – is the GREEN profit chart. Trading with fix 1 lot on the 1 EURO DAX CFD.  Using a re-invest rule the profit rocks up > 25K in the same period of time.

    I would be thrilled to see your version of the code beating the results of the RED and GREEN version. Let’s do a little competition here 🙂

     

    PS: The green one will be shared later …

    GraHal and paulon thanked this post
    DAX-4h-1.png DAX-4h-1.png
    #59351 quote
    Inertia
    Participant
    Master

    I have 27379 EUR… 10.000 bars (starting from October 1st 2013)

    Signal taken from the post #59336

    Code will be shared later 😉 I would be happy to see so other tentatives once I’ll be back from the soccer field … 😉

    mr blue thanked this post
    competition.png competition.png settings-competition.png settings-competition.png
    #59362 quote
    Eric
    Participant
    Master
    IF IntradayBarIndex = 1 THEN
    Hi = HIGHEST[1](HIGH)
    
    ENDIF
    
    RETURN Hi
    #59373 quote
    mr blue
    Participant
    Senior

    I have 27379 EUR… 10.000 bars (starting from October 1st 2013) Signal taken from the post #59336 Code will be shared later 😉 I would be happy to see so other tentatives once I’ll be back from the soccer field … 😉

    Thanks for posting your results. How does the result look like with only 1 LOT ?

    #59377 quote
    Inertia
    Participant
    Master

    Yes Mr Blue, let’s keep 1 lot only. I am working on 2016…

    competition-1-lot.png competition-1-lot.png
    #59380 quote
    Inertia
    Participant
    Master

    Ok. Below my last tentative…

    Competition-1-lot-II.png Competition-1-lot-II.png
    #59400 quote
    mr blue
    Participant
    Senior

    Well done Inertia! Any chance to mitimize the drag down early 2016?

    #59401 quote
    Inertia
    Participant
    Master

    Thx Mr Blue. All I know comes from this forum ;).

    Attached is the same strategy on 200.000 bars..

    Competition-200K.png Competition-200K.png
    #59415 quote
    verdi55
    Participant
    Veteran

    Thanks for posting your results. How does the result look like with only 1 LOT ?

    Not much better than buy and hold, I fear…

    It works because there is a bull market. You could as well buy every day, or once a week, or once a month.

    Buying at intermediate lows instead would increase performance somewhat, I think.

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

Can I buy at the high?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
paulon @paulon Participant
Summary

This topic contains 20 replies,
has 8 voices, and was last updated by mr blue
8 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/12/2018
Status: Active
Attachments: 7 files
Logo Logo
Loading...