open range strategy code – lot of success

Viewing 15 posts - 16 through 30 (of 39 total)
  • Author
    Posts
  • #48674 quote
    Andyswede
    Participant
    Master

    @Stefanb, yes that´s strange, 1.5 instead of fib in “set target pprofit box*1.5″ and 0,9 in spread, that´s about it.

    #48676 quote
    Stefanb
    Participant
    Senior

    Andy

     

    Forget it.

    Wrong by me.

    Sorry

    #48695 quote
    dillongr
    Participant
    Junior

    yes that is how I am running it. my entries are on the 2nd 5min close outside the range. Manually it works for for me,  but then again manually you can react to price action on the fly

    #48696 quote
    dillongr
    Participant
    Junior

    Thanks Despair.

    That is the problem I am having.  If you manually draw the range with fib extensions, you will see how often those targets are hit, but when we try code it, the results are not what I am seeing.  For example the dow and S&P hit the 261.8 targets 4 times last week.

    #48698 quote
    dillongr
    Participant
    Junior

    I have made a few changes, still not the results I expect.  On SAF 40 it is looking better, but no trades happening in september

    defparam cumulateorders=false
    
    tradingtime=dayofweek>=1 and dayofweek<=5 and time>=90000 and time <173000
    MAL=ExponentialAverage[5](close) > RangeTop
    MAS=ExponentialAverage[5](close) < RangeBottom
    once tc=0
    
    if time=90000 then
    RangeTop=highest[11](high[1])
    RangeBottom=lowest[11](low[1])
    endif
    
    if intradaybarindex=0 then
    tc=0
    endif
    
    CL=close>RangeTop
    CS=close<RangeBottom
    box=RangeTop-RangeBottom
    
    if not onmarket and not tc and tradingtime then
    if CL and MAl then
    buy 1 contract at market
    tc=1
    elsif CS and MAS then
    sellshort 1 contract at market
    tc=1
    endif
    set target pprofit box
    endif
    
    if longonmarket then
    sell at (RangeBottom*.6) stop
    elsif shortonmarket then
    exitshort at (RangeTop*.6) stop
    endif
    raphaelopilski thanked this post
    #48701 quote
    dillongr
    Participant
    Junior

    I notice that the short targets will not work as we are targeting the top of range,  I am trying to add criteria that defines a 161.8 expansion but I get errors.  Am I coding this correct?

    if longonmarket set target pprofit box*1.61
    elsif shortonmarket set target pprofit box*0.61
    endif
    endif
    #48712 quote
    Nicolas
    Keymaster
    Master

    You should make an indicator of the box and its target/stop and applied it on price, better to get a real idea of what happened or not and what to expect from any possible scenario, just my 2 cents 🙂 Great job everyone!

    #48746 quote
    dillongr
    Participant
    Junior

    good idea Nicolas!  Notice that the dax has broken its open range and on its way to the -61.8 Fibonacci extension.  It has already hit the height of the range target

    #48778 quote
    dillongr
    Participant
    Junior

    year is the ORB indicator code.  Is there a way to only show the lines on the current day during trading hours?

     

    if time =090000 then
    RangeTop=highest[6](high[1])
    RangeBottom=lowest[6](low[1])
    therange= rangetop-rangebottom
    tenentrylong=((therange*.3820)+rangetop)
    tenentryshort=(rangebottom-(therange*.3820))
    takeprofitlong=((therange*1.618)+rangetop)
    takeprofitshort=(rangebottom-(therange*1.618))
    endif
    
    return  rangetop as "top of range", rangebottom as "bottom of range", tenentrylong as "anti fake out long",tenentryshort as "anti fake out short", takeprofitlong as"Long Profit Target", takeprofitshort as"Short Profit Target"
    #48782 quote
    Nicolas
    Keymaster
    Master

    Like this?

    if dayofweek=currentdayofweek and time =090000 then
    RangeTop=highest[6](high[1])
    RangeBottom=lowest[6](low[1])
    therange= rangetop-rangebottom
    tenentrylong=((therange*.3820)+rangetop)
    tenentryshort=(rangebottom-(therange*.3820))
    takeprofitlong=((therange*1.618)+rangetop)
    takeprofitshort=(rangebottom-(therange*1.618))
    endif
    
    return  rangetop as "top of range", rangebottom as "bottom of range", tenentrylong as "anti fake out long",tenentryshort as "anti fake out short", takeprofitlong as"Long Profit Target", takeprofitshort as"Short Profit Target"
    #48784 quote
    dillongr
    Participant
    Junior

    S&P and Dow both hit their 61.8 open range targets

    #48785 quote
    dillongr
    Participant
    Junior

    that will work,  thanks!

    #48852 quote
    dillongr
    Participant
    Junior

    I played around last night, with some interesting results,  running it in demo now

    
    defparam cumulateorders=false
    
    tradingtime=dayofweek>=1 and dayofweek<=5 and time>=090500 and time <170000
    MAL=ExponentialAverage[5](close) > close[1]
    MAS=ExponentialAverage[5](close) < close[1]
    //once tc=0
    
    if time=090500 then
    RangeTop=highest[6](high[1])
    RangeBottom=lowest[6](low[1])
    endif
    
    //if intradaybarindex=0 then
    //tc=0
    //endif
    
    //CL=close>RangeTop
    //CS=close<RangeBottom
    box=RangeTop-RangeBottom
    entryl=close>=(rangetop+(box*.15))
    entrys=close<=(rangebottom-(box*.15))
    //trendlong=rangetop<ExponentialAverage[5](close)
    //trendshort=rangebottom>entrys
    
    if not onmarket and tradingtime then
    if entryl and mal  then
    buy 2 contract at market
    //tc=1
    elsif entrys and mas  then
    sellshort 2 contract at market
    //tc=1
    endif
    set target pprofit box*2.5
    endif
    
    if longonmarket then
    sell at ExponentialAverage[5](close)> ExponentialAverage[15](close)stop
    elsif shortonmarket then
    exitshort at ExponentialAverage[5](close)<ExponentialAverage[15](close) stop
    //elsif
    //endif
    endif
    
    //set stop loss 100
    
    #48867 quote
    mamio
    Participant
    Veteran

    This is the best I could get on Dax. The backtest on the last 30000 candles looks good.

    defparam cumulateorders=false
    defparam flatafter=173000
     
    tradingtime=dayofweek>=1 and dayofweek<=5 and time>=90000
    MA=ExponentialAverage[10](close) //15
    once tc=0
     
    if time=90000 then
    RangeTop=highest[11](high[1])
    RangeBottom=lowest[11](low[1])
    Box=RangeTop-RangeBottom
    endif
     
    if intradaybarindex=0 then
    tc=0
    endif
     
    CL=close>RangeTop and close[1]>RangeTop
    CS=close<RangeBottom and close[1]<RangeBottom
    box=RangeTop-RangeBottom
     
    if not onmarket and not tc and tradingtime then
    if CL and close>MA then
    buy 1 contract at market
    tc=1
    elsif CS and close<MA then
    sellshort 1 contract at market
    tc=1
    endif
    set target pprofit box*0.618
    endif
     
    // Stop Loss
    if longonmarket then
    sell at RangeBottom-box*1.618 stop
    elsif shortonmarket then
    exitshort at RangeTop+box*1.618 stop
    endif
    
    #48887 quote
    Nicolas
    Keymaster
    Master

    @dillongr

    There is something wrong with your exit conditions (pending orders) at lines 37 and 39. You are trying to put a stop order at 1 or 0 since you are using boolean conditions (is my first value is superior to my second one? TRUE=1 FALSE=0).

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

open range strategy code – lot of success


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
dillongr @dillongr Participant
Summary

This topic contains 38 replies,
has 10 voices, and was last updated by dillongr
7 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/08/2017
Status: Active
Attachments: 7 files
Logo Logo
Loading...