automatic trading supertrend

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #4032 quote
    groen200
    Participant
    Veteran

    Entry date
    Exit date
    Type
    Nbr Bars
    Abs Perf
    Relat Perf(%)
    Brokerage fee

    21-Mar-2016 08:10:00
    21-Mar-2016 09:45:00
    Short
    19
    -154
    -0.31%
    4

    21-Mar-2016 08:00:00
    21-Mar-2016 08:10:00
    Long
    2
    -51.5
    -0.10%
    4

    18-Mar-2016 10:05:00
    18-Mar-2016 10:45:00
    Long
    8
    -154
    -0.31%
    4

    18-Mar-2016 09:05:00
    18-Mar-2016 09:40:00
    Short
    7
    -154
    -0.31%
    4

    18-Mar-2016 08:05:00
    18-Mar-2016 09:00:00
    Long
    11
    -154
    -0.31%
    4

    18-Mar-2016 08:00:00
    18-Mar-2016 08:05:00
    Short
    1
    -108
    -0.22%
    4

    17-Mar-2016 09:10:00
    17-Mar-2016 12:00:00
    Short
    34
    1,185.50
    2.36%
    4

    17-Mar-2016 08:00:00
    17-Mar-2016 09:10:00
    Long
    14
    -27.5
    -0.05%
    4

    16-Mar-2016 11:15:00
    16-Mar-2016 12:00:00
    Short
    9
    -32.5
    -0.07%
    4

    16-Mar-2016 09:05:00
    16-Mar-2016 11:15:00
    Long
    26
    -16.5
    -0.03%
    4

    16-Mar-2016 08:00:00
    16-Mar-2016 09:05:00
    Short
    13
    -65
    -0.13%
    4

    15-Mar-2016 08:00:00
    15-Mar-2016 12:00:00
    Short
    48
    58.5
    0.12%
    4

    14-Mar-2016 10:50:00
    14-Mar-2016 11:30:00
    Short
    8
    -154
    -0.31%
    4

    14-Mar-2016 08:00:00
    14-Mar-2016 10:50:00
    Long
    34
    412
    0.83%
    4

    11-Mar-2016 08:00:00
    11-Mar-2016 12:00:00
    Long
    48
    705.5
    1.46%
    4

    10-Mar-2016 09:25:00
    10-Mar-2016 09:50:00
    Long
    5
    -154
    -0.32%
    4

    10-Mar-2016 08:25:00
    10-Mar-2016 09:20:00
    Short
    11
    -154
    -0.32%
    4

    10-Mar-2016 08:00:00
    10-Mar-2016 08:25:00
    Long
    5
    -90.5
    -0.19%
    4

    09-Mar-2016 09:20:00
    09-Mar-2016 12:00:00
    Long
    32
    137
    0.28%
    4

    09-Mar-2016 08:10:00
    09-Mar-2016 09:20:00
    Short
    14
    -119
    -0.25%
    4

    09-Mar-2016 08:00:00
    09-Mar-2016 08:10:00
    Long
    2
    -36.5
    -0.08%
    4

    08-Mar-2016 08:00:00
    08-Mar-2016 12:00:00
    Short
    48
    362.5
    0.75%
    4

    07-Mar-2016 08:35:00
    07-Mar-2016 12:00:00
    Short
    41
    326.5
    0.67%
    4

    07-Mar-2016 08:00:00
    07-Mar-2016 08:35:00
    Long
    7
    -54
    -0.11%
    4

    04-Mar-2016 11:40:00
    04-Mar-2016 12:00:00
    Long
    4
    84.5
    0.17%
    4

    04-Mar-2016 09:10:00
    04-Mar-2016 11:40:00
    Short
    30
    -45
    -0.09%
    4

    04-Mar-2016 08:00:00
    04-Mar-2016 09:10:00
    Long
    14
    -3.5
    -0.01%
    4

    03-Mar-2016 08:00:00
    03-Mar-2016 12:00:00
    Short
    48
    99
    0.20%
    4

    02-Mar-2016 10:25:00
    02-Mar-2016 12:00:00
    Short
    19
    200
    0.41%
    4

    02-Mar-2016 09:50:00
    02-Mar-2016 10:15:00
    Long
    5
    -154
    -0.31%
    4

    02-Mar-2016 08:00:00
    02-Mar-2016 09:50:00
    Short
    22
    5
    0.01%
    4

    01-Mar-2016 08:00:00
    01-Mar-2016 12:00:00
    Long
    48
    1,038.50
    2.20%
    4

    29/02/2016 11:10
    29/02/2016 11:25
    Long
    3
    -154
    -0.33%
    4

    29/02/2016 9:40
    29/02/2016 11:10
    Short
    18
    77.5
    0.16%
    4

    29/02/2016 9:35
    29/02/2016 9:35
    Short
    0
    -154
    -0.33%
    4

    29/02/2016 8:00
    29/02/2016 8:05
    Long
    1
    -154
    -0.33%
    4

    26/02/2016 11:55
    26/02/2016 12:00
    Short
    1
    6.5
    0.01%
    4

    26/02/2016 8:00
    26/02/2016 11:55
    Long
    47
    532
    1.13%
    4

    25/02/2016 8:00
    25/02/2016 12:00
    Short
    48
    51
    0.11%
    4

    24/02/2016 9:10
    24/02/2016 12:00
    Short
    34
    957.5
    2.04%
    4

    24/02/2016 8:00
    24/02/2016 9:10
    Long
    14
    14.5
    0.03%
    4

    23/02/2016 9:55
    23/02/2016 10:45
    Long
    10
    -154
    -0.32%
    4

    23/02/2016 8:00
    23/02/2016 9:55
    Short
    23
    -129
    -0.27%
    4

    22/02/2016 11:55
    22/02/2016 12:00
    Short
    1
    -18.5
    -0.04%
    4

    22/02/2016 8:10
    22/02/2016 11:55
    Long
    44
    440.5
    0.93%
    4

    22/02/2016 8:00
    22/02/2016 8:10
    Short
    2
    -117
    -0.25%
    4

    #4035 quote
    Nicolas
    Keymaster
    Master

    Ok groen! you did it! you have posted something on the forum 🙂

    So if this the result of a backtest or a real-traded strategy performance? And tell us what is your question?

    #4051 quote
    groen200
    Participant
    Veteran

    i want not more loss then 300 a day

    this is my code

    // Definitie van code parameters
    DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd
    
    DEFPARAM FLATBEFORE=080000
    DEFPARAM FLATAFTER=120000
    dayprofitmax=1500
    daylossmax=300
    
    if intradaybarindex=0 then
    trading=1
    lastdayprofit=strategyprofit
    endif
    
    if trading=1 and (strategyprofit > lastdayprofit+dayprofitmax or strategyprofit < lastdayprofit-daylossmax) then
    trading=0
    sell at market
    exitshort at market
    endif
    //indi
    st = SuperTrend[2.8,3]
    
    //resetting variable
    once lasttrade = 0
    
    IF LONGONMARKET then
    lasttrade = 1
    elsif SHORTONMARKET then
    lasttrade = -1
    elsif hour<8 OR hour>12 then
    lasttrade = 0
    endif
    
    // Condities om long posities te openen
    IF close>st AND lasttrade<>1 THEN
    EXITSHORT  AT MARKET
    BUY 1 LOT AT MARKET nextbaropen
    
    ENDIF
    
    // Condities om long posities te sluiten
    IF close<st AND lasttrade<>-1 THEN
    SELL  AT MARKET
    SELLSHORT 1 lot at market nextbaropen
    
    ENDIF
    
    // Stops en targets
    SET STOP $LOSS 150
    SET TARGET $PROFIT 1500
    #4052 quote
    groen200
    Participant
    Veteran

    i hope it is ok now

    #4172 quote
    Nicolas
    Keymaster
    Master

    Hello groen200, I see that someone else have changed the code a bit since the last time I helped you.

    In your code, the “daylossmax” parameter cut only actual trade but do not un-allow new ones to be launched. I think that I solved your problem :

    // Definitie van code parameters
    DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd
    
    DEFPARAM FLATBEFORE=080000
    DEFPARAM FLATAFTER=120000
    dayprofitmax=1500
    daylossmax=300
    
    if intradaybarindex=0 then
    trading=1
    lastdayprofit=strategyprofit
    endif
    
    if trading=1 and (strategyprofit > lastdayprofit+dayprofitmax or strategyprofit < lastdayprofit-daylossmax) then
    trading=0
    sell at market
    exitshort at market
    endif
    //indi
    st = SuperTrend[2.8,3]
    
    //resetting variable
    once lasttrade = 0
    
    IF LONGONMARKET then
    lasttrade = 1
    elsif SHORTONMARKET then
    lasttrade = -1
    elsif hour<8 OR hour>12 then
    lasttrade = 0
    endif
    
    // Condities om long posities te openen
    IF close>st AND lasttrade<>1 THEN
    EXITSHORT  AT MARKET
    if trading>0 then
    BUY 1 LOT AT MARKET nextbaropen
    endif
    ENDIF
    
    // Condities om long posities te sluiten
    IF close<st AND lasttrade<>-1 THEN
    SELL  AT MARKET
    if trading>0 then
    SELLSHORT 1 lot at market nextbaropen
    endif
    ENDIF
    
    // Stops en targets
    SET STOP $LOSS 150
    SET TARGET $PROFIT 1500
    #5097 quote
    wp01
    Participant
    Master

    Dear Nicolas,

    Thank you for the support on this forum.

    I’ve also tried your code with the supertrend. I understand that this is for trading with daily bars.

    My question is if this code easily can be modified for usage on the 15 or 20 minutes timeframe?

    Thanks in advance for your reply.

    Regards,

    Patrick

    #5110 quote
    Nicolas
    Keymaster
    Master

    Hello wp01,

    Since SuperTrend is an indicator that can be traded in any timeframe, this automated trading strategy code can be used for 15 or 20 minutes ones with no problem. This is not my code but a strategy made/submitted by groen200.

    As I remember correctly this strategy is already traded by this member in intraday charts, so you can use it as is, or adapt the Supertrend period to the instrument or timeframe you’d like to trade with. Change the period at line 20 :

    st = SuperTrend[2.8,3]
    #5137 quote
    wp01
    Participant
    Master

    Thanks for the reply Nicolas.

    I understand that i can use it in 15 or 20 minutes but I have no idea what to change in line 20.

    #5231 quote
    Michael
    Participant
    Veteran

    The System is performing very well , I ‘m using it with one more timesetup e.g from 09:00 – 13:00 with also good results

    #5232 quote
    Nicolas
    Keymaster
    Master

    @wp01

    At line 20, you’ll find the Supertrend parameters to adapt, look at the documentation and you’ll understand what I mean : http://www.prorealcode.com/documentation/supertrend/

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

automatic trading supertrend


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
groen200 @groen200 Participant
Summary

This topic contains 9 replies,
has 4 voices, and was last updated by Nicolas
10 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/21/2016
Status: Active
Attachments: No files
Logo Logo
Loading...