Strategy SR Dow J Day

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #137408 quote

    Hi Vonasi,
    When I make the optimizations of my trading systems I ALWAYS stop in December 2017 for any Time Frame, so the computer cannot know beyond that date what happened …. in the attached graph it starts Without the time-based sale from 1 January 2018. …… clearly I try to have the odds in my favor certainty does not exist in anything …..
    I thank you for your work and I wish you a good evening …

    Strategy-SR-Dow-J.-Day-2010-2020-E.png Strategy-SR-Dow-J.-Day-2010-2020-E.png
    #137432 quote
    Paul
    Participant
    Master

    the set target profit needs to be straight below the buy order because it uses average range & close. 

    It can not be put on the bottom. It’s placed correct and uses the close when conditions are true to go long.

    however, you do not use not longonmarket, so, if your are long and conditions are true to go long again are ignored (because  DEFPARAM CumulateOrders = false) , it updates the target with the new close of that bar which is incorrect. To have it correct I think you have to use not longonmarket?

    If you add not longonmarket performance goes down, however, if you take every signal when in a long and losing position to close & reenter again long, it’s much better.

    here again a but, because not sure why the code below makes such a difference.

    if condbuy[1] then
    buy positionsize contract at market
    SET TARGET PROFIT 5* averagetruerange[1](close)
    endif

    or

    if condbuy[1] then
    buy positionsize contract at market
    SET TARGET PROFIT 5* averagetruerange[1](close)[1]
    endif

     

    // Strategy SR Dow J. Day     indicator by roberto gozzi
    
    DEFPARAM CumulateOrders = false
    
    once tradetype          = 2 // [1]long & short; [2]long only; [3]short only
    once reenter            = 0 // [0]off; [1]reenter based on positionperftype
    once positionperftype   = 0 // [0]perf<>ppv; [1]perf<ppv; [2]perf>ppv
    once positionperfvalue  = 0
    
    indicator1 =  ADX[10]
    indicator2 = ADXR[14]
    c2 = (indicator1[1] > indicator2[1])
    indicator11 = ADX[10]
    c1 = (indicator11[1] >= 15)
    c30 =TR(close)>25
    ONCE PrezzoC = 0
    ONCE PrezzoB = 0
    ONCE PrezzoA = 0
    Prezzo = CALL SRtest
    IF Prezzo > 0 THEN
    PrezzoA = PrezzoB
    PrezzoB = PrezzoC
    PrezzoC = Prezzo
    ENDIF
    
    positionsize=1
    
    LossMonth  =200
    once StopMonth=1
    IF Month <> Month[1] THEN
    ProfitMonth=strategyprofit
    StopMonth=1
    endif
    If strategyprofit<=ProfitMonth-LossMonth then
    StopMonth=0
    endif
    
    Cond    = PrezzoB > PrezzoA AND PrezzoB > PrezzoC
    
    condbuy=StopMonth=1 and close CROSSES UNDER PrezzoB AND C2 AND C1 AND C30 AND Cond > 0
    
    // CONDBUY=CONDBUY AND NOT LONGONMARKET
    
    condsell=1
    ctime=1
    
    // entry criteria
    if ctime then
    if (tradetype=1 or tradetype=2) then
    if condbuy then
    buy positionsize contract at market
    SET TARGET pPROFIT 5* averagetruerange[1](close)
    endif
    endif
    if (tradetype=1 or tradetype=3) then
    if condsell and not shortonmarket then
    sellshort positionsize contract at market
    endif
    endif
    if reenter then
    if positionperftype=1 then
    positionperformance=positionperf(0)*100<-positionperfvalue  // in loss
    elsif positionperftype=2 then
    positionperformance=positionperf(0)*100>positionperfvalue // in profit
    else
    positionperformance=((positionperf(0)*100)<-positionperfvalue or (positionperf(0)*100)>positionperfvalue) // in loss or profit
    endif
    if (tradetype=1 or tradetype=2) then
    if condbuy and longonmarket and positionperformance then
    sell at market
    endif
    if condbuy[1] then
    buy positionsize contract at market
    SET TARGET PROFIT 5* averagetruerange[1](close)  // or [1] at the end?
    endif
    endif
    if (tradetype=1 or tradetype=3) then
    if condsell and shortonmarket and positionperformance then
    exitshort at market
    endif
    if condsell[1] and not shortonmarket then
    sellshort positionsize contract at market
    endif
    endif
    endif
    else
    if longonmarket and condsell then
    //sell at market
    endif
    if shortonmarket and condbuy then
    //exitshort at market
    endif
    endif
    
    If longonmarket and (barindex-tradeindex)>=43 then
    //SELL AT MARKET
    ENDIF
    
    Trailinglong     = 2* averagetruerange[5](close)
    Trailingsteplong = 5* averagetruerange[1](close)
    TGL = Trailinglong
    STPL = Trailingsteplong
    if not onmarket then
    MAXPRICE = 0
    PREZZOUSCITA = 0
    ENDIF
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close)
    if MAXPRICE-tradeprice(1)>=TGL then
    PREZZOUSCITA = MAXPRICE-STPL
    ENDIF
    ENDIF
    if onmarket and PREZZOUSCITA>0 then
    EXITSHORT AT PREZZOUSCITA STOP
    SELL AT PREZZOUSCITA STOP
    ENDIF
    
    SET STOP   %LOSS  8
    #137436 quote
    Vonasi
    Moderator
    Master

    however, you do not use not longonmarket, so, if your are long and conditions are true to go long again are ignored (because  DEFPARAM CumulateOrders = false) , it updates the target with the new close of that bar which is incorrect. To have it correct I think you have to use not longonmarket?

    Well spotted Paul. When I added my SEB testing code to the strategy I encased the STOP and TARGET orders in an IF NOT ONMARKET condition so that I could count all possible trades outside of that condition – so my version did not behave the same as the original. I should try to find time to retest with the varying stop and target orders. Bit busy at the moment as leaving the harbour to go sailing for the summer in a few days time and so lots of jobs to do – including hours and hours of fixing my back-up navigation laptop. Who would think it could be so difficult to get a netbook working on XP!

    Paul thanked this post
    #137458 quote

    Hello Paul,
    The operation from 1 January 2018 is identical …. and it is the only important thing …… if we had put in real since that date in both ways we would have had the same results.
    Thank you

    (I am attaching the graph of your variant from January 2018.)

    Strategy-SR-Dow-J.-Day-2010-2020-Paul.png Strategy-SR-Dow-J.-Day-2010-2020-Paul.png
Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.

Strategy SR Dow J Day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 18 replies,
has 4 voices, and was last updated by Mauro T. “Algorithm System”
5 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/27/2020
Status: Active
Attachments: 14 files
Logo Logo
Loading...