set big line values automatically

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #54507 quote
    Paul
    Participant
    Master

    Hi, 

    I’am trying a strategy based on the close which crosses a big lines.

    This is for the dax, but how can you calculate these big line numbers automatically and quickly, so the strategy is use-full for other markets without too much hassle? I thought about using the interval values, but it becomes messy quick. Is there a better way?

    Thanks in advance.

    // lines for dax
    //sv=13100  //start value
    //ivm=100   //interval value medium lines
    //ivb=1000  //interval value big lines
    
    l1= close crosses over 13100 or close crosses over 12100 or close crosses over 11100 or close crosses over 10100 or close crosses over 9100
    l2= close crosses over 13200 or close crosses over 12200 or close crosses over 11200 or close crosses over 10200 or close crosses over 9200
    l3= close crosses over 13300 or close crosses over 12300 or close crosses over 11300 or close crosses over 10300 or close crosses over 9300
    l4= close crosses over 13400 or close crosses over 12400 or close crosses over 11400 or close crosses over 10400 or close crosses over 9400
    l5= close crosses over 13500 or close crosses over 12500 or close crosses over 11500 or close crosses over 10500 or close crosses over 9500
    l6= close crosses over 13600 or close crosses over 12600 or close crosses over 11600 or close crosses over 10600 or close crosses over 9600
    l7= close crosses over 13700 or close crosses over 12700 or close crosses over 11700 or close crosses over 10700 or close crosses over 9700
    l8= close crosses over 13800 or close crosses over 12800 or close crosses over 11800 or close crosses over 10800 or close crosses over 9800
    l9= close crosses over 13900 or close crosses over 12900 or close crosses over 11900 or close crosses over 10900 or close crosses over 9900
    l10=close crosses over 14000 or close crosses over 13000 or close crosses over 12000 or close crosses over 11100 or close crosses over 10000
    
    s1= close crosses under 13100 or close crosses under 12100 or close crosses under 11100 or close crosses under 10100 or close crosses under 9100
    s2= close crosses under 13200 or close crosses under 12200 or close crosses under 11200 or close crosses under 10200 or close crosses under 9200
    s3= close crosses under 13300 or close crosses under 12300 or close crosses under 11300 or close crosses under 10300 or close crosses under 9300
    s4= close crosses under 13400 or close crosses under 12400 or close crosses under 11400 or close crosses under 10400 or close crosses under 9400
    s5= close crosses under 13500 or close crosses under 12500 or close crosses under 11500 or close crosses under 10500 or close crosses under 9500
    s6= close crosses under 13600 or close crosses under 12600 or close crosses under 11600 or close crosses under 10600 or close crosses under 9600
    s7= close crosses under 13700 or close crosses under 12700 or close crosses under 11700 or close crosses under 10700 or close crosses under 9700
    s8= close crosses under 13800 or close crosses under 12800 or close crosses under 11800 or close crosses under 10800 or close crosses under 9800
    s9= close crosses under 13900 or close crosses under 12900 or close crosses under 11900 or close crosses under 10900 or close crosses under 9900
    s10=close crosses under 14000 or close crosses under 13000 or close crosses under 12000 or close crosses under 11000 or close crosses under 10000

     

    #54516 quote
    AutoStrategist
    Participant
    Veteran

    Hi Paul,  The levels can be created using the mod operator, see the code example below.  You might want to add some loops to store the level values. 

    CurrentPrice = close
    AboveLevell0 = CurrentPrice mod 10
    StartLevel = CurrentPrice - AboveLevell0
    
    Level10Up = StartLevel + 10
    Level20Up = StartLevel + 20 // etc.
    
    Levell0Down = StartLevel - 10
    Level20Down = StartLevel- 20 // etc.

     

    Paul thanked this post
    #54579 quote
    Paul
    Participant
    Master

    Here’s the adjusted code. The results do not match the pic. Can you see something obvious wrong ?

    //-------------------------------------------------------------------------
    // Main code : Big Line Strategy
    //-------------------------------------------------------------------------
    
    // common rules
    DEFPARAM CUMULATEORDERS = false
    DEFPARAM PRELOADBARS = 10000
    
    // time rules
    ONCE entertime = 090000
    ONCE lasttime  = 180000
    ONCE closetime = 240000 // greater then 23.59 means it continues position overnight
    ONCE closetimefriday=180000
    
    tt1 = time >= entertime
    tt2 = time <= lasttime
    tradetime = tt1 and tt2
    
    // positionsize and stops
    positionsize=1
    sl=1   // % stoploss
    ts=1.5 // % trailing stop
    pt=2.5 // % profit target
    
    // setup number of trades intraday
    if IntradayBarIndex = 0 then
    longtradecounter = 0
    Shorttradecounter = 0
    endif
    
    // trade criteria
    lc = tradetime and countoflongshares < 1 and longtradecounter < 1
    sc = tradetime and countofshortshares < 1 and shorttradecounter < 1
    
    // lines for dax
    CurrentPrice = round(dclose(1))
    mp = 100
    AboveLevell0 = CurrentPrice mod mp
    StartLevel = CurrentPrice - AboveLevell0
    
    Level10Up = StartLevel + (1*mp)
    Level20Up = StartLevel + (2*mp)
    Level30Up = StartLevel + (3*mp)
    Level40Up = StartLevel + (4*mp)
    Level50Up = StartLevel + (5*mp)
    Level60Up = StartLevel + (6*mp)
    Level70Up = StartLevel + (7*mp)
    Level80Up = StartLevel + (8*mp)
    Level90Up = StartLevel + (9*mp)
    
    Levell0Down = StartLevel - (1*mp)
    Level20Down = StartLevel - (2*mp)
    Level30Down = StartLevel - (3*mp)
    Level40Down = StartLevel - (4*mp)
    Level50Down = StartLevel - (5*mp)
    Level60Down = StartLevel - (6*mp)
    Level70Down = StartLevel - (7*mp)
    Level80Down = StartLevel - (8*mp)
    Level90Down = StartLevel - (9*mp)
    
    l0= close crosses over StartLevel
    l1= close crosses over Level10Up
    l2= close crosses over Level20Up
    l3= close crosses over Level30Up
    l4= close crosses over Level40Up
    l5= close crosses over Level50Up
    l6= close crosses over Level60Up
    l7= close crosses over Level70Up
    l8= close crosses over Level80Up
    l9= close crosses over Level90Up
    
    s0=close crosses under StartLevel
    s1= close crosses under Levell0Down
    s2= close crosses under Level20Down
    s3= close crosses under Level30Down
    s4= close crosses under Level40Down
    s5= close crosses under Level50Down
    s6= close crosses under Level60Down
    s7= close crosses under Level70Down
    s8= close crosses under Level80Down
    s9= close crosses under Level90Down
    
    // extra long and short criteria
    elc=high < MIN(dhigh(1),dhigh(2))
    esc=low > MAX(dlow(1),dlow(2))
    
    // long entry
    If lc and elc and (l0 or l1 or l2 or l3 or l4 or l5 or l6 or l7 or l8 or l9) then
    buy positionsize contract at market
    longtradecounter=longtradecounter + 1
    endif
    
    // short entry
    if sc and esc and (s0 or s1 or s2 or s3 or s4 or s5 or s6 or s7 or s8 or s9) then
    sellshort positionsize contract at market
    shorttradecounter=shorttradecounter + 1
    endif
    
    // exit all
    If onmarket and time >= closetime then
    sell at market
    exitshort at market
    endif
    
    // exit friday at set closetime
    if onmarket and (CurrentDayOfWeek=5 and time>=closetimefriday) then
    sell at market
    exitshort at market
    endif
    
    // build-in exit
    SET STOP %LOSS sl %TRAILING ts
    SET TARGET %PROFIT pt
    
    //GRAPH 0 coloured(300,0,0) AS "zeroline"
    //GRAPH (positionperf*100)coloured(0,0,0,255) AS "PositionPerformance"
    

     

     

    #54585 quote
    AutoStrategist
    Participant
    Veteran

    Hi Paul, the difference is that the fixed lines are created once and the dynamic way of doing it is creating the levels on each 5 minute bar.  By creating the levels once a day e.g. if time = 080000 (any time before your start time) you will get the same result as per the previous version, actually better due to the Dhigh() and Dlow() checks you added.

    #54597 quote
    Paul
    Participant
    Master

    Thanks for your response!

    To check if lines were correct I created a indicator. So lines are dynamic, based on a yesterday’s high.

    The index is never out of the *dynamic range*, so I thought it should be the same as fixed lines, but it isn’t.

    I will try new approach.

     

    #54633 quote
    Nicolas
    Keymaster
    Master

    You could try to make the “CurrentPrice”, the last Close and see what happens:

    CurrentPrice = round(close)

    Since the code is read only once per bar, the round levels should be always calculated with the  Close of the current 5 minutes bar.

    #54730 quote
    Paul
    Participant
    Master

    I tried your idea Nicolas. It didn’t work. Because when lines zigzag around a big line, the lines could move 1 bar. I think as a result the condition crossed was not met. Also tried the idea from AutoStrategist. But somehow it made the strategy 100x slower. But I found the cause. Somehow I overlooked I specified before only 1 part of the criteria for a big line.  But a line needs 2 criteria.

    l0= close crosses over Level00Up or close crosses over Level00Down

    Thanks for the tips!

    #54731 quote
    Paul
    Participant
    Master

    Here’s the complete strategy.

    #54735 quote
    Nicolas
    Keymaster
    Master

    Thank you Paul! Should be in the Library too! Do you want to post it there?

    FYI I posted a new indicator to spot these round levels recently: https://www.prorealcode.com/prorealtime-indicators/sweet-spots-numbers/

     

    #54822 quote
    noisette
    Participant
    Veteran

    Very strange: When I’m not connected, I see that there are attachment in some of thes posts but when I’m logged, I can’t see attachments.

    And that is not the case in other disscusions.

    Am I the only one who have thi problem?

    #54826 quote
    Nicolas
    Keymaster
    Master

    @Noisette

    Are you talking about this topic only? Or in any other topic of the forums? Because there are no attachments at all in this specific thread.

    When not connected, you are browsing cached pages which may be “old” (one hour or so..), so that’s possible that you might spot some differences if you are logged or not. 

    #54831 quote
    noisette
    Participant
    Veteran

    @Nicolas: I saw this problem only in some threads.

    I’m sure that there were attachments in some of the posts above. For example about 1 hour ago, in #53731 there were a picture and an itf file to download that disappeared when I logged in.

    And now no attachment (log in or log out)

    Thanks.

    #54850 quote
    Nicolas
    Keymaster
    Master

    I understand now why these files have been deleted, while Paul send a new post in the library, he deleted its own old files.. No worry the strategy will be available in the code library today after a short review.

    EDIT: the strategy is now available in the library: big line strategy for DAX

    #54940 quote
    noisette
    Participant
    Veteran

    Ok. That’s clear Nicolas.

    So thank you Paul for your code. In my opinion Dax and Nasdaq Should be the most suitable for this strategy.

    I’ll try some modifications and tests and wiĺl share if it improve performance. 

     

     

     

     

     

    Nicolas thanked this post
    #105751 quote
    Paul
    Participant
    Master
    Checking out this old system. Updated a bit. Try use factor 50 or 100. It needs an extra filter, but current run is nice. On DAX30, TF 5min
    //-------------------------------------------------------------------------
    // Main code : Big Line Strategy
    //-------------------------------------------------------------------------
    
    // common rules
    defparam cumulateorders = false
    defparam preloadbars = 10000
    
    once extracriteria   = 2  // [0]off or [1]strict or [2]most strict for higher timeframes
    
    once enablesl = 1     // stoploss
    once enablept = 1     // profit target
    once enablets = 1     // trailing stop
    once enablebe = 1     // breakeven stop
    
    once timeexit = 1     // test i.e. without ts but with be
    
    //activate graph(onprice); maximum 5 lines active !
    once displaysl  = 0   // stop loss [1 line]
    once displaypt  = 0   // profit target [1 line]
    once displayts  = 0   // trailing stop [3 lines]
    once displaybe  = 0   // breakeven stop [1 line]
    once displaydim = 0   // days in market [1 line]
    once displaypp  = 0   // position performance [1 line]
    
    once holiday = 1  
    
    once factor = 100 //i.e. action at 50 lines or 100 lines
    
    positionsize = 1
    
    sl = 1   // % stoploss
    pt = 1.25   // % profit target
    
    // trailingstop exit activates when positionperformance (pp)
    ts1=0.35     // is greater then this percentage then use trailingstop ts1
    
    switch=0.45   // is greater then this percentage then use trailingstop ts2
    ts2=0.25
    switch2=0.60  // is greater then this percentage then use trailingstop ts3
    ts3=0.20
    
    // breakeven exit
    besg = 0.30 // % break even stop gain
    besl = 0.05 // % break even stop level
    
    // used for sl/pt/ (not used for ts); not to be optimized!
    // forex use 0.01; securities use 1, index use 100
    // profittargets and stoploss have to match the lines with displaysl/tp/ts set to 1
    underlaying=100
    
    // reset at start
    if intradaybarindex=0 then
    longtradecounter=0
    shorttradecounter=0
    tradecounter=0
    ecshort=1
    eclong=1
    tradeday= 1
    endif
    
    // holiday
    if holiday then
    // prevent trading first week in a new year
    if year=2015 and month=1 and day<=4 then
    tradeday = 0
    elsif year=2016 and month=1 and day<=3 then
    tradeday = 0
    elsif year=2017 and month=1 and day<=8 then
    tradeday = 0
    elsif year=2018 and month=1 and day<=7 then
    tradeday = 0
    elsif year=2019 and month=1 and day<=6 then
    tradeday = 0
    // prevent trading yearly common holiday's
    elsif month=12 and day=24 then  // before christmas day
    tradeday = 0
    elsif month=12 and day=25 then  // christmas day
    tradeday = 0
    elsif month=12 and day=26 then  // after christmas day
    tradeday = 0
    elsif month=12 and day=31 then  // old years eve
    tradeday = 0
    // prevent trading on a public holiday in germany; market can be open
    elsif year=2019 and month=4 and day=19 then   // holiday in germany; good friday
    tradeday = 0
    elsif year=2018 and month=3 and day=30 then   // holiday in germany; good friday
    tradeday = 0
    elsif year=2017 and month=4 and day=14 then   // holiday in germany; good friday
    tradeday = 0
    elsif year=2019 and month=4 and day=22 then   // holiday in germany; easter monday
    tradeday = 0
    elsif year=2018 and month=4 and day=2 then    // holiday in germany; easter monday
    tradeday = 0
    elsif year=2017 and month=4 and day=17 then   // holiday in germany; easter monday
    tradeday = 0
    elsif month=5 and day=1 then                  // holiday in germany; labour day
    tradeday = 0
    elsif year=2019 and month=5 and day=30 then   // holiday in germany; ascension day
    tradeday = 0
    elsif year=2018 and month=5 and day=10 then   // holiday in germany; ascension day
    tradeday = 0
    elsif year=2017 and month=5 and day=25 then   // holiday in germany; ascension day
    tradeday = 0
    elsif year=2019 and month=6 and day=10 then   // holiday in germany; whit monday
    tradeday = 0
    elsif year=2018 and month=6 and day=21 then   // holiday in germany; whit monday
    tradeday = 0
    elsif year=2017 and month=6 and day=5 then    // holiday in germany; whit monday
    tradeday = 0
    elsif month=10 and day=3 then                 // holiday in germany; unity day
    tradeday = 0
    else
    tradeday = 1
    endif
    endif
    
    // day & time
    ONCE entertime = 090000
    ONCE lasttime  = 180000
    once closetime = 240000 // greater then 23.59 means it continues position overnight
    once fridayclosetime = 180000
    
    tradetime = (time>=entertime and time<lasttime) and tradeday
    
    // [pc] position criteria (also set a limit to the number of trades a day) (or set high for no impact)
    pclong  = countoflongshares  < 1 and longtradecounter  < 1 and tradecounter < 1
    pcshort = countofshortshares < 1 and shorttradecounter < 1 and tradecounter < 1
    
    //[mc] main criteria
    CurrentPrice = round(dclose(1))
    MPmod  = 100
    Factor = Factor
    AboveLevel0 = CurrentPrice mod MPmod
    StartLevel = CurrentPrice - AboveLevel0
    
    Level00Up = Startlevel
    Level10Up = StartLevel + (1*Factor)
    Level20Up = StartLevel + (2*Factor)
    Level30Up = StartLevel + (3*Factor)
    Level40Up = StartLevel + (4*Factor)
    Level50Up = StartLevel + (5*Factor)
    Level60Up = StartLevel + (6*Factor)
    Level70Up = StartLevel + (7*Factor)
    Level80Up = StartLevel + (8*Factor)
    Level90Up = StartLevel + (9*Factor)
    
    Level00Down = Startlevel
    Levell0Down = StartLevel - (1*Factor)
    Level20Down = StartLevel - (2*Factor)
    Level30Down = StartLevel - (3*Factor)
    Level40Down = StartLevel - (4*Factor)
    Level50Down = StartLevel - (5*Factor)
    Level60Down = StartLevel - (6*Factor)
    Level70Down = StartLevel - (7*Factor)
    Level80Down = StartLevel - (8*Factor)
    Level90Down = StartLevel - (9*Factor)
    
    l0= close crosses over Level00Up or close crosses over Level00Down
    l1= close crosses over Level10Up or close crosses over Levell0Down
    l2= close crosses over Level20Up or close crosses over Level20Down
    l3= close crosses over Level30Up or close crosses over Level30Down
    l4= close crosses over Level40Up or close crosses over Level40Down
    l5= close crosses over Level50Up or close crosses over Level50Down
    l6= close crosses over Level60Up or close crosses over Level60Down
    l7= close crosses over Level70Up or close crosses over Level70Down
    l8= close crosses over Level80Up or close crosses over Level80Down
    l9= close crosses over Level90Up or close crosses over Level90Down
    
    s0= close crosses under Level00Down or close crosses under Level00Up
    s1= close crosses under Levell0Down or close crosses under Level10Up
    s2= close crosses under Level20Down or close crosses under Level20Up
    s3= close crosses under Level30Down or close crosses under Level30Up
    s4= close crosses under Level40Down or close crosses under Level40Up
    s5= close crosses under Level50Down or close crosses under Level50Up
    s6= close crosses under Level60Down or close crosses under Level60Up
    s7= close crosses under Level70Down or close crosses under Level70Up
    s8= close crosses under Level80Down or close crosses under Level80Up
    s9= close crosses under Level90Down or close crosses under Level90Up
    
    mclong=(l0 or l1 or l2 or l3 or l4 or l5 or l6 or l7 or l8 or l9)
    mcshort=(s0 or s1 or s2 or s3 or s4 or s5 or s6 or s7 or s8 or s9)
    
    // [ec] extra criteria
    if extracriteria then
    eclong  = high < dhigh(1)
    ecshort = low  > dlow(1)
    elsif extracriteria=2 then
    min1 = min(dhigh(0),dhigh(1))
    min2 = min(dhigh(1),dhigh(2))
     
    max1 = max(dlow(0),dlow(1))
    max2 = max(dlow(1),dlow(2))
     
    eclong = high < min(min1,min2)
    ecshort =low > max(max1,max2)
    endif
    
    // long entry
    if tradetime then
    If pclong and mclong and eclong then
    buy positionsize contract at market
    longtradecounter=longtradecounter + 1
    tradecounter=tradecounter+1
    endif
    
    // short entry
    if pcshort and mcshort and ecshort then
    sellshort positionsize contract at market
    shorttradecounter=shorttradecounter + 1
    tradecounter=tradecounter+1
    endif
    endif
    
    //
    pp=(positionperf*100)
    
    // trailing stop
    if enablets then
    trailingstop1 = (tradeprice(1)/100)*ts1
    trailingstop2 = (tradeprice(1)/100)*ts2
    trailingstop3 = (tradeprice(1)/100)*ts3
    if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    maxprice1=0
    minprice1=close
    priceexit1=0
    maxprice2=0
    minprice2=close
    priceexit2=0
    maxprice3=0
    minprice3=close
    priceexit3=0
    a1=0
    a2=0
    a3=0
    pp=0
    endif
    if onmarket then
    if pp>=ts1 then
    a1=1
    endif
    if pp>=switch then
    a2=1
    endif
    if pp>=switch2 then
    a3=1
    endif
    endif
    // setup long
    if longonmarket then
    maxprice1=max(maxprice1,close)
    maxprice2=max(maxprice2,high)
    maxprice3=max(maxprice3,high)
    if a1 then
    if maxprice1-tradeprice(1)>=(trailingstop1)*pointsize then
    priceexit1=maxprice1-(trailingstop1/(underlaying/100))*pointsize
    endif
    endif
    if a2 then
    if maxprice2-tradeprice(1)>=(trailingstop2)*pointsize then
    priceexit2=maxprice2-(trailingstop2/(underlaying/100))*pointsize
    endif
    endif
    if a3 then
    if maxprice3-tradeprice(1)>=(trailingstop3)*pointsize then
    priceexit3=maxprice3-(trailingstop3/(underlaying/100))*pointsize
    endif
    endif
    endif
    // setup short
    if shortonmarket then
    minprice1=min(minprice1,close)
    minprice2=min(minprice2,low)
    minprice3=min(minprice3,low)
    if a1 then
    if tradeprice(1)-minprice1>=(trailingstop1)*pointsize then
    priceexit1=minprice1+(trailingstop1/(underlaying/100))*pointsize
    endif
    endif
    if a2 then
    if tradeprice(1)-minprice2>=(trailingstop2)*pointsize then
    priceexit2=minprice2+(trailingstop2/(underlaying/100))*pointsize
    endif
    endif
    if a3 then
    if tradeprice(1)-minprice3>=(trailingstop3)*pointsize then
    priceexit3=minprice3+(trailingstop3/(underlaying/100))*pointsize
    endif
    endif
    endif
    // exit long
    if longonmarket and priceexit1>0 then
    sell at priceexit1 stop
    endif
    if longonmarket and priceexit2>0 then
    sell at priceexit2 stop
    endif
    if longonmarket and priceexit3>0 then
    sell at priceexit3 stop
    endif
    // exit short
    if shortonmarket and priceexit1>0 then
    exitshort at priceexit1 stop
    endif
    if shortonmarket and priceexit2>0 then
    exitshort at priceexit2 stop
    endif
    if shortonmarket and priceexit3>0 then
    exitshort at priceexit3 stop
    endif
    if displayts then
    //graphonprice priceexit1 coloured(0,0,255,255) as "trailingstop1"
    //graphonprice priceexit2 coloured(0,0,255,255) as "trailingstop2"
    //graphonprice priceexit3 coloured(0,0,255,255) as "trailingstop3"
    endif
    endif
    
    // break even stop
    if enablebe then
    if not onmarket then
    newsl=0
    endif
    if ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    newsl=0
    endif
    if longonmarket then
    if close-tradeprice(1)>=(((tradeprice(1)/100)*besg)/(underlaying/100))*pointsize then
    newsl=tradeprice(1)+(((tradeprice(1)/100)*besl)/(underlaying/100))*pointsize
    endif
    endif
    if shortonmarket then
    if tradeprice(1)-close>=(((tradeprice(1)/100)*besg)/(underlaying/100))*pointsize then
    newsl=tradeprice(1)-(((tradeprice(1)/100)*besl)/(underlaying/100))*pointsize
    endif
    endif
    if longonmarket and newsl>0 then
    sell at newsl stop
    endif
    if shortonmarket and newsl>0 then
    exitshort at newsl stop
    endif
    if displaybe then
    //graphonprice newsl coloured(244,102,27,255) as "breakevenstop"
    endif
    endif
    
    // set stoploss
    if enablesl then
    if not onmarket then
    sloss=0
    elsif longonmarket then
    sloss=tradeprice(1)-((tradeprice(1)*sl)/underlaying)*pointsize
    elsif shortonmarket then
    sloss=tradeprice(1)+((tradeprice(1)*sl)/underlaying)*pointsize
    endif
    set stop %loss sl
    if displaysl then
    //graphonprice sloss coloured(255,0,0,255) as "stoploss"
    sloss=sloss
    endif
    endif
    
    // to display profittarget
    if enablept then
    if not onmarket then
    ptarget=0
    elsif longonmarket then
    ptarget=tradeprice(1)+((tradeprice(1)*pt)/underlaying)*pointsize
    elsif shortonmarket then
    ptarget=tradeprice(1)-((tradeprice(1)*pt)/underlaying)*pointsize
    endif
    set target %profit pt
    if displaypt then
    //graphonprice ptarget coloured(121,141,35,255) as "profittarget"
    ptarget=ptarget
    endif
    endif
    
    // exit at closetime
    if onmarket then
    if time >= closetime or (currentdayofweek=5 and time>=fridayclosetime) then
    sell at open stop
    exitshort at open stop
    endif
    endif
    
    //timeexit
    if timeexit then
    if (hour=14 and minute=00) and pp>0 then
    sell at market
    exitshort at market
    elsif hour=23 then
    sell at market
    exitshort at market
    endif
    endif
    
    if onmarket then
    if currentdayofweek=5 and time=fridayclosetime then
    sell at market
    exitshort at market
    endif
    endif
    
    // display days in market
    if displaydim then
    if not onmarket then
    dim=0
    endif
    if (onmarket and not onmarket[1]) or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    dim=1
    endif
    if  not (dayofweek=1 and hour = 1) then
    if onmarket then
    if openday <> openday[1] then
    dim = dim + 1
    endif
    endif
    endif
    //graph dim coloured(121,141,35,255) as "days in market"
    endif
    
    if displaypp then
    //graph pp  coloured(0,0,0,255) as "positionperformance"
    endif
    
    //for trading all graph & graphonprice have to be comment out
    //for backtesting and to have a visual idea of exits or pp
    //uncomment and set displaysl and/or displaypt and/or displayts to 1
    //maximum of 5 can be used to display lines (graph & graphonprice combined)
    
    Nicolas thanked this post
Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

set big line values automatically


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Paul @micky75d Participant
Summary

This topic contains 14 replies,
has 4 voices, and was last updated by Paul
6 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/02/2017
Status: Active
Attachments: No files
Logo Logo
Loading...