Scalper Machine V1 Dax

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #19779 quote
    Antonios
    Participant
    Junior

    I would like to show you my first attempt to create a system.It is a Scalp system for Timeframe 1 hr Dax ,Take Profit 4 pips and Trailing Stop 12 pips. The System start in 8 30 pm Time Zone GMT+1 and stop 17 00, Spread is 1 point .It has become backtest from 2012 and the results the see above.
    Any feedback and any suggestions are welcome!Enjoy it!

    //-------------------------------------------------------------------------
    // Main code : A Scalper Machine V1 dax
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // A SCALPER MACHINE V1
    //-------------------------------------------------------------------------
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    REM All positions will be not open before this time
    defparam flatbefore = 080000
    REM All positions will be closed after this time
    defparam flatafter = 165000
    
    
    // MONEY MANAGMENT
    
    QTY=1
    ONCE M=500
    BANK=100
    
    
    ONCE PQTYADJUST=0
    
    QTYADJUST = ROUND(STRATEGYPROFIT /M)
    
    IF QTYADJUST > 0 THEN
    
    QTY=QTY+QTYADJUST
    
    IF QTYADJUST < PQTYADJUST THEN
    M=M+BANK
    PQTYADJUST=QTYADJUST
    ENDIF
    IF QTYADJUST > PQTYADJUST THEN
    PQTYADJUST=QTYADJUST
    ENDIF
    
    ELSE
    QTY=1
    
    ENDIF
    
    
    
    // VARIABLE..  FOR EASY  BACKTESTING ////////
    
    
    a=55
    b=2
    n=2
    z=7
    v=23
    q=2
    a1=12
    b1=1
    k=15
    w=2
    
    
    ts1=9
    ema = Exponentialaverage[ts1](close)
    advance=abs(round(ema-ema[1]))
    
    
    /////////////////////////////////////////////////////////////////////////////////////////
    
    // TIME AND DAY MANAGMENT
    
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry =  OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // trading window
    ONCE startTime = 083000
    ONCE endTime = 170000
    
    // trade only in trading window 9-20
    IF Time >= startTime AND Time <= endTime THEN
    
    // MAIN SYSTEM //
    
    
    
    
    
    // Conditions to enter long positions
    indicator1 = Average[n](close)
    indicator2 = Average[z](close)
    c1 = (indicator1 > indicator2)
    
    indicator3 = Stochastic[a,b](close)
    indicator4 = Average[v](Stochastic[a,b](close))
    c2 = (indicator3 > indicator4)
    
    indicator5 = MACDline[12,26,9](close)
    indicator6 = ExponentialAverage[q](MACDline[12,26,9](close))
    c3 = (indicator5 > indicator6)
    
    
    // Conditions to enter short positions
    indicator9 = Average[a1](close)
    indicator10 = Average[b1](close)
    c5 = (indicator9 > indicator10)
    
    indicator11 = Average[k](Stochastic[a,b](close))
    indicator12 = Stochastic[a,b](close)
    c6 = (indicator11 > indicator12)
    
    indicator13 = ExponentialAverage[w](MACDline[12,26,9](close))
    indicator14 = MACDline[12,26,9](close)
    c7 = (indicator13 > indicator14)
    
    
    // LONG
    if not longonmarket and  c1 AND c2 AND c3  and  Momentum[11](close)>0 and  RSI[6](close)>65 and  not daysForbiddenEntry  then
    BuyPrice = ema+advance
    buy qty contract at BuyPrice limit
    endif
    
    // SHORT
    
    if not shortonmarket and c5 AND c6 AND c7  and  Momentum[11](close)<0 and RSI[6](close)<35 and not daysForbiddenEntry then
    SellPrice = ema-advance
    sellshort qty contract at sellprice limit
    
    ENDIF
    
    set stop pTRAILING  12
    
    set target Pprofit 4
    endif
    
    Jesús, Paris, mikenew and FREDNC thanked this post
    antbacktest-14834573154pc8l1.png antbacktest-14834573154pc8l1.png
    #19784 quote
    Nicolas
    Keymaster
    Master

    Hi Antonios, I moved your post from the library pending queue to the forum.

    Unfortunately, you have been trapped into the “0 bar phenomena” which is a well-known and common problem of Probacktest result before the version 10.3 of prorealtime. If the stoploss and takeprofit price levels are met within the same bar, the takeprofit is tested first and your trade is a winning one, but it would not be the case in real time trading.

    I see that you have optimized a lot, all indicators periods, which is not good, the result is over-fitted on the past data.

    So, I’m sorry but the backtest is not good here. Please don’t be offend, we are all here to help each other 🙂 Your questions are welcome.

    Paris, jaHko, MaoRai54 and Midlanddave thanked this post
    #23928 quote
    Inertia
    Participant
    Master

    Hi there, if I may suggest a good book for everyone interested in automatic strategy: “Building Winning Algorithmic Trading Systems”… This book will explain in details what Nicolas means…

    Cheers.

    #23938 quote
    Joachim Nilsson
    Participant
    Average

    I get this result with 10.3 tick by tick. Still look too good to be true.

     

    Nicolas- Is this the same backtest problem that we have in the backtest in Rauls 5 min intraday thread?

    Skärmavbild-2017-02-04-kl.-19.40.51.png Skärmavbild-2017-02-04-kl.-19.40.51.png
    #23942 quote
    Raul Vg
    Participant
    Senior

    A question, what is the point of placing a trailing of 12 points if you put a take profit of 4?

    #24015 quote
    Paris
    Participant
    Veteran

    just put it on live , you knows …..

    #24017 quote
    noisette
    Participant
    Veteran

    Thank you Antonios for this interesting code.

    Ratio is very good and I like when you are few time in market. Let’s have a look if tick by tick backtest and demo mode have same results…

    About optimization: backtests are still good when I modify a little bit variables.

    Growth of the contracts number if perhaps too much exponantial for me.

    Could you just tell us how did you find this strategy?

    #24040 quote
    Antonios
    Participant
    Junior

    Thank for all to the feedback in system,I have some problems with backtest in 1hr,I try to solve it and will come back with the upgrading…Raul….Trailing Stop and Take Profit The results  of backtesting.

    #24053 quote
    Inertia
    Participant
    Master

    Hi Antonios,

    Thank you for the code. Looks very good.

    Do you think that you can attach a printscreen for us ?

    Cheers,

    DJ

    #24163 quote
    Paris
    Participant
    Veteran

    i ve put a trailling stop of 5 only and i ve it on live demo ….

    #24348 quote
    Antonios
    Participant
    Junior

    Hello Traders!

    I would like to forgive me for not so good  English but is don’t my native language.

    I want once again to thank you all  for feedback to my system,and  and especially  the Alex ,the algorithm gave me the idea for my system.This new version is for 2HR ,1 point spread , trading hours 09:00-19:00 GMT+1,Initial capital is 200 $ ,Risk= 2,and Dax 1Mini.

    Trailling Stop 65  and Take Profit 12.The results are from 2012 tick by tick,and  he wants is the attention to DD in the Risk=2.

    Enjoy that.

    ////////////SCALPING MACHINE V3.1////////////////////////////////////////////
    
    defparam cumulateorders=false
    defparam preloadbars=1000
    //defparam flatbefore = 080000
    REM All positions will be closed after this time
    //defparam flatafter = 203000
    
    
    
    
    
    ////////// MONEY MANAGMENT//////////////////////////////////////////////////
    equity = Capital + StrategyProfit
    maxrisk = round(equity*(Risk/100))
    PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
    Capital = 200
    Risk = 1.7
    StopLoss = round(margin*2)
    margin = rangepips*rangepercent
    rangepercent =0.1
    REM NIGHT MAX
    maximo = dhigh(0)
    REM NIGHT MIN
    minimo = dlow(0)
    REM RANGE IN PIPS BETWEEN NIGHT MAX AND MIN
    rangepips = round(maximo-minimo)
    
    
    /////////////////VARIAMBLES/////////////////////////////////////////////////
    
    
    
    ts1=9
    ema = Exponentialaverage[ts1](close)
    once uma=Highest[ts1](high)
    once umb=Lowest[ts1](low)
    Wave=39*pipsize
    a=11
    b=13
    n=13
    z=4
    v=12
    q=26
    a1=9
    b1=9
    k=1
    
    
    
    ////////////////////TIME MANAGMENT//////////////////////////////////////////
    ONCE startTime = 090000
    ONCE endTime = 190000
    
    IF Time >= startTime AND Time <= endTime THEN
    
    ////////////////////////////////////////////////////////////////////////
    
    
    
    /////////CONDITIONS TO ENTER LONG&SHORT ////////////////////////
    
    ///////////////LONG/////////////////////////////////////////////
    indicator1 = Average[a](close)
    indicator2 = Average[b](close)
    c1 = (indicator1 > indicator2)
    
    indicator3 = Stochastic[n,z](close)
    indicator4 = Average[a](Stochastic[n,z](close))
    c2 = (indicator3 > indicator4)
    
    indicator5 = MACDline[v,q,a1](close)
    indicator6 = ExponentialAverage[9](MACDline[v,q,a1](close))
    c3 = (indicator5 > indicator6)
    
    
    ////////////SHORT//////////////////////////////////////////////////
    
    indicator9 = Average[b1](close)
    indicator10 = Average[k](close)
    c5 = (indicator9 > indicator10)
    
    indicator11 = Average[a](Stochastic[n,z](close))
    indicator12 = Stochastic[n,z](close)
    c6 = (indicator11 > indicator12)
    
    indicator13 = ExponentialAverage[9](MACDline[v,q,a1](close))
    indicator14 = MACDline[v,q,a1](close)
    c7 = (indicator13 > indicator14)
    
    /////////////////////// CONDITIONS////////////////////////////////
    
    if High > ema and Low < ema then // Touching Ema8
    tb = BarIndex
    ltp = ema
    uma = ema
    umb = ema
    endif
    
    if low>ema then //  New bullish movement
    n = BarIndex - tb
    uma=Highest[n](high)
    umb=ema
    endif
    
    if high<ema then //  New bearish movement
    m = BarIndex - tb
    umb=Lowest[m](low)
    uma=ema
    endif
    
    if (uma-ltp)>Wave and uma>ema then // buy condition
    myres=1
    endif
    if (uma-ltp)<=wave then
    myres=0
    endif
    
    if (ltp-umb)>wave and umb<ema then // short condition
    mysub=-1
    endif
    if (ltp-umb)<=wave then
    mysub=0
    endif
    
    advance=abs(round(ema-ema[1]))
    //mylot=2
    
    ///////////MAIN///////////////////////////////////////////////////////
    
    if not longonmarket and myres=1 and c1 and c2 and c3 and Momentum[11](close)>0 then
    BuyPrice = ema+advance
    buy positionsize contract at BuyPrice limit
    endif
    
    if not shortonmarket and mysub=-1 and c5 and c6 and c7 and Momentum[11](close)<0 then
    SellPrice = ema-advance
    sellshort positionsize contract at sellprice limit
    endif
    
    endif
    
    ///////////MONEY MANAGMENT//////////////////////////////////////////////////
    
    //set stop ploss 76
    set stop pTRAILING 65
    set target pprofit 12
    
    AntonioScalperSystemv3.1.png AntonioScalperSystemv3.1.png AntoniosScalpersystemres.png AntoniosScalpersystemres.png
    #24358 quote
    Antonios
    Participant
    Junior

    ……….Update…..everything is OK after for backtesting , will have to change this variable…….a=7

    a=7
    b=13
    n=13
    z=4
    v=12
    q=26
    a1=9
    b1=9
    k=1
    new1b.png new1b.png antonios13.png antonios13.png
    #25760 quote
    Aloysius
    Participant
    Veteran

    As Nicolas told you, the backtests (even the last one) are not made in “tick by tick” mode. If you rectify, you will see that the system is always loosing.

    #25787 quote
    jonjon
    Participant
    Average

    Hi Antonios. I’m trying to backtest and understand this for myself as you have included many things which are new to me and which I would like to learn. Problem is that I am getting no trades when I run the backtest. I’m in London…all I have changed are the times to:

     

    ONCE startTime = 080000
    ONCE endTime = 180000

    and I’m looking at the Dax 2H. I have changed a=7.

     

    Please can you let me know if there is anything else that I need to change. Apologies in advance if I’m missing something obvious.

    #25788 quote
    AleX
    Participant
    Senior

    same for me, no trades

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

Scalper Machine V1 Dax


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Antonios @palaki06 Participant
Summary

This topic contains 22 replies,
has 14 voices, and was last updated by VinzentVega
5 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/04/2017
Status: Active
Attachments: 11 files
Logo Logo
Loading...