Updated strategy

Viewing 15 posts - 1 through 15 (of 31 total)
  • Author
    Posts
  • #8333 quote
    Adolfo
    Participant
    Senior

    This post belongs to this system: http://www.prorealcode.com/prorealtime-trading-strategies/dax-trading-strategy-breakoutfakeout/

    A few changes were made after start the strategy in real time with some troubles. Some adjuntments and improvements

    Major change

    Code problems mades system don’t put stop and limit orders after entering a position. Now the system runs with fixed orders “PLOSS” and “PPROFIT” to avoid this. Tested in real time and working OK.

    Minor changes

    1. It will run from Monday to Thursday, not even Friday, Saturday or Sunday. As I suppose Fridays are more often sideways and prefered to avoid this day.
    2. Min distance for stoploss is now 6 pips, as far as IG broker don’t let it start with less.
    3. Max range was 200 points, now is 150. Max risk for this system is 0,5% of actual equity, so stoploss shouldn’t exceed 15 pips.

    FULL CODE

    //-------------------------------------------------------------------------
    // Main code : Binomio AutoTrading Bot v.2 DAX
    //-------------------------------------------------------------------------
    REM #########################################
    REM ## Binomio AutoTrading Bot 2016 DAX 1m ##
    REM #########################################
    
    REM Not cumulate orders
    defparam cumulateorders = false
    REM No positions open before this time
    defparam flatbefore = 080000
    REM All positions will be closed after this time
    defparam flatafter = 213000
    
    REM MAX and MIN we want to operate
    REM No orders will be set if range is greater than
    maxrange = 150
    REM No orders will be set if range is shorter than
    minrange = 20
    
    REM Parameters
    profitvalue = 1.5 // % Range (1.5 = 150%) 
    rangepercent = 0.1 // %Range (0.1 = 10%)
    
    REM ######################
    REM ## MONEY MANAGEMENT ##
    REM ######################
    Capital = 3000 // Initial capital
    Risk = 0.5 // %Risk max
    
    REM RESET MAIN VARIABLES EACH NEW DAY
    if Dayofweek = 5 then
    trading = 0
    else
    If intradaybarindex = 0 then
    trading = 1
    bullish = 0
    bearish = 0
    inrange = 0
    rangepips = 0
    enter1 = 0
    enter2 = 0
    enter3 = 0
    enter4 = 0
    abovemax = 0
    abovemin = 0
    belowmax = 0
    belowmin = 0
    //profittrend = 0
    profitrange = 0
    endif
    endif
    
    
    REM CHECK CONTROL TIME
    starttime = 075500
    endtime = 075900
    
    REM RANGE ESTABLISHMENT
    IF time >= starttime and time <= endtime then
    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)
    REM PROFIT IN PIPS EX
    takeprofit = rangepips*profitvalue// i.e we could add here "*0.9" to reduce the profit objective
    REM DISTANCE FROM LINES TO SET ORDERS
    margin = rangepips*rangepercent
    REM SET MAX ORDER PLACES
    abovemax = maximo+margin
    belowmax = maximo-margin
    REM SET MIN ORDER PLACES
    abovemin = minimo+margin
    belowmin = minimo-margin
    REM SET NUMBER OF PIPS TO RISK EACH TRADE
    StopLoss = round(margin*2)
    if StopLoss<6 then
    StopLoss = 6
    endif
    endif
    
    REM Calculate contracts
    equity = Capital + StrategyProfit
    maxrisk = round(equity*(Risk/100))
    PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)
    
    REM SPREAD CHECK
    IF Time>=090000 and time<173000 then
    spread = 0 // Backtest spread is set to 1
    else
    spread = 1 // Backtest spread 1 + 1 = Real spread
    endif
    
    REM CONDICION DEL MERCADO
    inrange = Close<maximo-margin and close>minimo+margin
    bullish = Close>(maximo+margin)
    bearish = Close<(minimo-margin)
    semibull = Close>maximo-margin and close<maximo+margin
    semibear = close<minimo+margin and close>minimo-margin
    
    REM START SETTING ORDERS
    REM FIRST TRADES
    if not onmarket and trading = 1 and rangepips<=maxrange and rangepips>=minrange then
    REM RESET VARIABLES EACH TIME WE ARE OUT OF THE MARKET
    if bearish then
    if enter4=0 then
    sellshort PositionSize contract at market//belowmin limit
    endif
    if enter1=0 then
    buy PositionSize contract at abovemin+spread stop
    endif
    endif
    if bullish then
    if enter3=0 then
    buy PositionSize contract at market//abovemax limit
    endif
    if enter2=0 then
    sellshort PositionSize contract at belowmax-spread stop
    endif
    endif
    if inrange then
    if enter1=0 then
    buy PositionSize contract at abovemin limit
    endif
    if enter2=0 then
    sellshort PositionSize contract at belowmax limit
    endif
    if enter3=0 then
    buy PositionSize contract at abovemax+spread stop
    endif
    if enter4=0 then
    sellshort PositionSize contract at belowmin-spread stop
    endif
    endif
    if semibull then
    if enter3=0 then
    buy PositionSize contract at abovemax+spread stop
    endif
    if enter2=0 then
    sellshort PositionSize contract at belowmax-spread stop
    endif
    endif
    if semibear then
    if enter1=0 then
    buy PositionSize contract at abovemin+spread stop
    endif
    if enter4=0 then
    sellshort PositionSize contract at belowmin-spread stop
    endif
    endif
    endif
    
    buytrend = tradeprice(1)>maximo
    buyrange = tradeprice(1)<maximo
    selltrend = tradeprice(1)<minimo
    sellrange = tradeprice(1)>minimo
    
    REM SI ESTAMOS LARGOS
    if longonmarket then
    REM IF TRADE PRICE IS ABOVE MAX
    if buytrend then
    enter3 = 1
    if enter2=0 then
    sellshort PositionSize contract at belowmax-spread stop
    endif
    endif
    REM IF TRADE PRICE IS INTO DE RANGE
    if buyrange then
    enter1 = 1
    if enter4=0 then
    sellshort PositionSize contract at belowmin-spread stop
    endif
    endif
    endif
    
    REM SI ESTAMOS CORTOS
    if shortonmarket then
    REM SI HEMOS VENDIDO POR DEBAJO DEL MINIMO
    if selltrend then
    enter4 = 1
    if enter1=0 then
    buy PositionSize contract at abovemin+spread stop
    endif
    endif
    
    REM SI HEMOS VENDIDO DENTRO DEL RANGO
    if sellrange then
    enter2 = 1
    if enter3=0 then
    buy PositionSize contract at abovemax+spread stop
    endif
    endif
    endif
    
    set stop ploss stoploss
    set target pprofit takeprofit
    
    
    Binomio-AutoTrading-Bot-DAX-v2.itf
    #8343 quote
    Nicolas
    Keymaster
    Master

    Thanks Adolfo, I’ll change your library post accordingly to this new version.

    #8347 quote
    Adolfo
    Participant
    Senior

    You’re wellcome Nicolas.

    I saw a few good changes in website recently, each day looks better!  Thanks a lot for giving us a space like this.

    Have a nice day and better trading!!

    #8395 quote
    Adolfo
    Participant
    Senior

    Hey everyone! I did a Monte Carlo test with attached results.

    Do you have any experience with this monte carlo one?

    What do you think about results?

    Cheers!

    ATB-DAX-1m-monte-carlo.png ATB-DAX-1m-monte-carlo.png
    #8412 quote
    deleted190722
    Participant
    New

    Hi Adolfo, I am working with montecarlo during these days… If you send me your data I run it whit my system (very similar with nicolas system) and we can open a new thread where to disucuss how to read the montecarlo.

    what do you think?

    #8416 quote
    Adolfo
    Participant
    Senior

    Hi David, I <3 it.

    Do you need something else than results? There are 418 trades, how do I send it to you?

    Is posible for you to share monte carlo test also?

    Cheers!

    #8459 quote
    deleted190722
    Participant
    New

    please drag the last page of the result of the backtest into excel and share it here.

    #8461 quote
    deleted190722
    Participant
    New

    remember to put the spread in it

    #8462 quote
    Adolfo
    Participant
    Senior

    GM!!! I attached an image in first post, did you see that?

    Where is spread’s place?

    #8466 quote
    deleted190722
    Participant
    New

    sorry, maybe I explained wrong.

    I have done it for you. this is the montecarlo test for your system on dax 1 minute with spread equal to 1. Dax 1 euro per point.

    The result that you have posted where without the spreads in it. they were fake results. If you add the spread the TS does not perform good.

    Comments? Am I doing something wrong?

    1-7.png 1-7.png 2-1.png 2-1.png 3.png 3.png
    #8471 quote
    Adolfo
    Participant
    Senior

    Hey David, just realized that your backtest were only 100.000 units rather than 200.000 is I did, see attached results for full period. It does 403 trades with 1 point spread.

    Shall I send to you a text plain file with trades?

    ATB-200000-test.png ATB-200000-test.png ATB-200000-test-spread.png ATB-200000-test-spread.png
    #8475 quote
    deleted190722
    Participant
    New

    yes.. with IG I can do only 100.000 bars. Send me the list of closed position in excel.

    #8476 quote
    Adolfo
    Participant
    Senior

    Ok David, sorry for inconvenience and thanks for your efforts. Here are results in excel.

    ATB-trade-list.xls
    #8481 quote
    deleted190722
    Participant
    New

    I need it full like this. just drag and drop the matrix in excel.

    Nothing more…

    1-8.png 1-8.png
    #8486 quote
    Adolfo
    Participant
    Senior

    Aha! get it… I saw a forbbiden an icon, sry!

    ATB-trade-list-1.xls
Viewing 15 posts - 1 through 15 (of 31 total)
  • You must be logged in to reply to this topic.

Updated strategy


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
Adolfo @adolfo_onrubia Participant
Summary

This topic contains 30 replies,
has 7 voices, and was last updated by GraHal
6 years, 7 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 05/30/2016
Status: Active
Attachments: 16 files
Logo Logo
Loading...