Discussing the strategy VECTORIAL DAX (M5)

Viewing 15 posts - 961 through 975 (of 1,264 total)
  • Author
    Posts
  • #147761 quote
    Paul
    Participant
    Master

    Here’s the code I was thinking about. In general I don’t like to keep a position over the weekend, but if there is one. Put the gap 50 to 0 to have it always active with or without positionperformance.

    if onmarket then
    if dayofweek=0 and (hour=0 and minute>=57) and abs(dopen(0)-dclose(1))>50 and positionperf(0)>0 then
    if shortonmarket and close>dopen(0) then
    exitshort at market
    endif
    if longonmarket and close<dopen(0) then
    sell at market
    endif
    endif
    endif
    #147770 quote
    Tanou
    Participant
    Senior

    I think this could be very useful! This fraiday I had an order that starts at 20:10 and was about to get an over weekend position so I cuted i in the positive as I didn’t want to keep it!

     


    @Paul
    , do you have any ideas that you’d like to test or changes to make that you think of and that I could try and give you feedback on to get more gain. I run out of ideas…

    #147779 quote
    Paul
    Participant
    Master

    well atm I ran out of idea’s too. What I wonder instead of increasing the gains, not to prevent a bad entry, but how to react to a bad entry such as today. Just to watch the market going opposite and al you can do is hope it will reverse course.

    Something like if there are no certain gains made after the position is entered, close after xx bars=time.

    here’s something to test 🙂

    So you need to see a gain of atleast 20 points in 3 hours after a position is taken or else close it.

    I don’t know if I want to go down this road with curvefitting. There’s already plenty!

    if longonmarket and highest[barindex-tradeindex(1)](high)-tradeprice(1)<20 and barindex-tradeindex>80 then
    sell at market
    endif
    if shortonmarket and tradeprice(1)-lowest[barindex-tradeindex(1)](low)<20 and barindex-tradeindex>80 then
    //exitshort at market
    endif
    Screenshot-2020-10-19-at-17.17.08.jpg Screenshot-2020-10-19-at-17.17.08.jpg
    #147782 quote
    Tanou
    Participant
    Senior

    THAT’S EXACTLY WHAT I WAS TRYING NOW! 😀

     

    I think it could be a great way to cut some positions sooner to prvent losses 🙂

    I am also trying to get this system with a stochastic momentum index more than bars, I’ll try both and see 😉

    #147783 quote
    Tanou
    Participant
    Senior

    And in you’re code you wrote 80 bars which is 4 hours and not 3 just ! 😉

    #147786 quote
    Tanou
    Participant
    Senior

    I tried this, bit better ratio but less gain obviously….

    //SL above 0 if more than X hours and positive
    
    SLafterXhours=0
    
    if longonmarket and barindex-tradeindex>60 then
    if close-tradeprice(1)>=2 then
    sell at SLafterXhours STOP
    endif
    endif
    
    if shortonmarket and barindex-tradeindex>40 then
    if tradeprice(1)-close>=2 then
    EXITSHORT at SLafterXhours STOP
    endif
    endif
    #147802 quote
    Paul
    Participant
    Master

    I would refrain from using stop orders and use market, especially on fast timeframe. Then you don’t have to mess with rejections etc.

    Actually there is already an already exit available in the code but it wasn’t used. (spreaking v3p5)

    Maybe this one can be improved? Short was already active but for long was not used.  If it was active with value minrangedistL=1 it would h’ve exit long way earlier.

    Using it as is, with addition that if there is not enough gains, the minrangedistance gets reduced. So start at 3 and reducing it to 1.

    // reversal exit
    once longexit =1
    once shortexit=1
    if longexit then
    if longonmarket then
    minrangedistL=1
    cl1=close<open and close[1]<open[1] and close[2]<open[2]
    cl2=(close=low or close[1]=low[1] or close[2]=low[2])
    cl3=(range>(close/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL)
    if  cl1 and cl2 and cl3 then
    sell at market
    endif
    endif
    endif
    
    if shortexit then
    if shortonmarket then
    minrangedistS=1.5
    cs1=close>open and close[1]>open[1] and close[2]>open[2]
    cs2=(close=high or close[1]=high[1] or close[2]=high[2])
    cs3=(range>(close/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS)
    if  cs1 and cs2 and cs3 then
    exitshort at market
    endif
    endif
    endif
    
    #147803 quote
    XORANDNOT
    Participant
    Senior

    Just replaced the trailing stops with an ordinary trailing stop, and added a new profit taking routine to the old version Vectorial Dax V3 (04/13/2019, #96328). Code is shorter, and after some nice curve fitting, gain has doubled.

    Vectorial-Dax-V3.itf Vectorial-Dax-V3-modif.itf DAX-5-Minutes.png DAX-5-Minutes.png
    #147808 quote
    Paul
    Participant
    Master

    an ordinary trailing-stop is not a ptrailing stop used in one strategy as in general it’s not recommended. But it’s good to take a step back sometimes and have a short & effective code. Whatever works!

    #147826 quote
    MAKSIDE
    Participant
    Veteran
    LR = LinearRegression[1]
    LRslope = LR[0] - LR[1]
    LRslopebuy = LRsplope > 0

    I added this condition for the uptrend. Yesterday’s trade was really catastrophic..

    It’s another version of Vectorial .. but maybe an idea around that

    #147837 quote
    VinzentVega
    Participant
    Veteran

    The yesterdays SL was the 4th full SL (2%) and the 8th SL bigger than 1% this year. Actually the profit rate in October is bad. To many small winners on one side, and to many loosing trades on the other side. But up to now, this month ist not negativ. But also, it don´t needs one more big looser again.

    #147866 quote
    Tanou
    Participant
    Senior

    Hello Paul,

    You mean like that? Because implementing it this way didn’t get pretty good results…

     

    //-------------------------------------------------------------------------
    // Code principal : Vectorial DJ 3 min V3
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Code principal : DJ 3m Vectorial V3
    //-------------------------------------------------------------------------
    // VECTORIAL MM - DJ 3m
    DEFPARAM CumulateOrders = false
    DEFPARAM Preloadbars = 50000
    //Money Management
    MM = 0 // = 0 for optimization
    if MM = 0 then
    positionsize=1
    ENDIF
    if MM = 1 then
    ONCE startpositionsize = .2
    ONCE factor = 10 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etc
    ONCE margin = (close*.05) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverage
    ONCE margin2 = (close*.05)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverage
    ONCE tier1 = 55 // IG first tier margin limit
    ONCE maxpositionsize = 550 //  IG tier 2 margin limit
    ONCE minpositionsize = .2 // enter minimum position allowed
    IF Not OnMarket THEN
    positionsize = startpositionsize + Strategyprofit/(factor*margin)
    ENDIF
    IF Not OnMarket THEN
    IF startpositionsize + Strategyprofit/(factor*margin) > tier1 then
    positionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 margin
    ENDIF
    IF Not OnMarket THEN
    if startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THEN
    positionsize = minpositionsize //keeps positionsize from going below allowed minimum
    ENDIF
    IF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize then
    positionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limit
    ENDIF
    ENDIF
    ENDIF
    ENDIF
    
    
    //HORAIRES DE TRADING
    Ctime = time >= 153000 and time < 210000
    
    
    //STRATEGIE
    //VECTEUR = CALCUL DE L'ANGLE
    
    i1 = HistoricVolatility[10](close)
    c1 = (i1 >= 0.06)
    
    ONCE PeriodeA = 4
    ONCE nbChandelierA= 30
    MMA = Exponentialaverage[PeriodeA](close)
    ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA
    ANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTE
    CB1 = ANGLE >= 32
    CS1 = ANGLE <= - 44
    
    
    //VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILE
    ONCE PeriodeB = 30
    ONCE nbChandelierB= 35
    lag = 0
    MMB = Exponentialaverage[PeriodeB](close)
    pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB
    trigger = Exponentialaverage[PeriodeB+lag](pente)
    CB2 = (pente > trigger) AND (pente < 0)
    CS2 = (pente CROSSES UNDER trigger) AND (pente > - 0.5)
    
    mx = average[110,0](close)
    CB3 = mx > mx[1]
    mx2 = average[20,0](close)
    CS3 = mx2 < mx2[1]
    
    //ENTREES EN POSITION
    CONDBUY = CB1 and CB2 and CB3 and CTime and c1
    CONDSELL = CS1 and CS2 and CS3 and Ctime and c1
    
    
    //POSITION LONGUE
    IF CONDBUY THEN
    buy positionsize contract at market
    SET STOP %LOSS 2.6
    ENDIF
    
    //POSITION COURTE
    IF CONDSELL THEN
    Sellshort positionsize contract at market
    SET STOP %LOSS 0.6
    ENDIF
    
    //SET TARGET %PROFIT 2
    
    //Break even
    breakevenPercent = .13
    PointsToKeep = 1
    startBreakeven = tradeprice(1)*(breakevenpercent/100)
    
    once breakeven = 1//1 on - 0 off
    //reset the breakevenLevel when no trade are on market
    if breakeven>0 then
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    // --- BUY SIDE ---
    //test if the price have moved favourably of "startBreakeven" points already
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    //calculate the breakevenLevel
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
     
    //place the new stop orders on market at breakevenLevel
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    // --- end of BUY SIDE ---
     
    IF SHORTONMARKET AND tradeprice(1)-close>startBreakeven*pipsize THEN
    
    //calculate the breakevenLevel
    breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
    ENDIF
    //place the new stop orders on market at breakevenLevel
    IF breakevenLevel>0 THEN
    EXITSHORT AT breakevenLevel STOP
    ENDIF
    endif
    
    // reversal exit
    once longexit =1
    once shortexit=1
    if longexit then
    if longonmarket then
    minrangedistL=1
    cl1=close<open and close[1]<open[1] and close[2]<open[2]
    cl2=(close=low or close[1]=low[1] or close[2]=low[2])
    cl3=(range>(close/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL or range[1]>(close[1]/1000)*minrangedistL)
    if  cl1 and cl2 and cl3 then
    sell at market
    endif
    endif
    endif
    
    if shortexit then
    if shortonmarket then
    minrangedistS=1.5
    cs1=close>open and close[1]>open[1] and close[2]>open[2]
    cs2=(close=high or close[1]=high[1] or close[2]=high[2])
    cs3=(range>(close/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS or range[1]>(close[1]/1000)*minrangedistS)
    if  cs1 and cs2 and cs3 then
    exitshort at market
    endif
    endif
    endif
    #147870 quote
    Tanou
    Participant
    Senior

    I just tried both of your versions with 200k . It’s looking quite good but I wouldn’t let it alone in real. The profit factor is too small for a 45% winning strategie…!

     

    I tried to change few things but doesn’t work 🙁

    #147877 quote
    Paul
    Participant
    Master

    Tanou something like that, but using long didn’t work. How’s short only?

    ps nobody uses WF or HE?

    #147878 quote
    Tanou
    Participant
    Senior

    In the code that I put above both long and short were active if I’m not wrong!

     

    What do you mean by WF and HE?

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

Discussing the strategy VECTORIAL DAX (M5)


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Balmora74 @balmora74 Participant
Summary

This topic contains 1,263 replies,
has 125 voices, and was last updated by VinzentVega
1 year ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/24/2019
Status: Active
Attachments: 470 files
Logo Logo
Loading...