automatic trading supertrend
Forums › ProRealTime English forum › ProOrder support › automatic trading supertrend
- This topic has 9 replies, 4 voices, and was last updated 8 years ago by Nicolas.
Tagged: daily loss, daily profit, supertrend
-
-
03/21/2016 at 11:37 AM #4032
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 03/21/2016 at 12:38 PM #403503/21/2016 at 8:10 PM #4051i want not more loss then 300 a day
this is my code
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849// Definitie van code parametersDEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerdDEFPARAM FLATBEFORE=080000DEFPARAM FLATAFTER=120000dayprofitmax=1500daylossmax=300if intradaybarindex=0 thentrading=1lastdayprofit=strategyprofitendifif trading=1 and (strategyprofit > lastdayprofit+dayprofitmax or strategyprofit < lastdayprofit-daylossmax) thentrading=0sell at marketexitshort at marketendif//indist = SuperTrend[2.8,3]//resetting variableonce lasttrade = 0IF LONGONMARKET thenlasttrade = 1elsif SHORTONMARKET thenlasttrade = -1elsif hour<8 OR hour>12 thenlasttrade = 0endif// Condities om long posities te openenIF close>st AND lasttrade<>1 THENEXITSHORT AT MARKETBUY 1 LOT AT MARKET nextbaropenENDIF// Condities om long posities te sluitenIF close<st AND lasttrade<>-1 THENSELL AT MARKETSELLSHORT 1 lot at market nextbaropenENDIF// Stops en targetsSET STOP $LOSS 150SET TARGET $PROFIT 150003/21/2016 at 8:13 PM #405203/23/2016 at 8:28 PM #4172Hello 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 :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051// Definitie van code parametersDEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerdDEFPARAM FLATBEFORE=080000DEFPARAM FLATAFTER=120000dayprofitmax=1500daylossmax=300if intradaybarindex=0 thentrading=1lastdayprofit=strategyprofitendifif trading=1 and (strategyprofit > lastdayprofit+dayprofitmax or strategyprofit < lastdayprofit-daylossmax) thentrading=0sell at marketexitshort at marketendif//indist = SuperTrend[2.8,3]//resetting variableonce lasttrade = 0IF LONGONMARKET thenlasttrade = 1elsif SHORTONMARKET thenlasttrade = -1elsif hour<8 OR hour>12 thenlasttrade = 0endif// Condities om long posities te openenIF close>st AND lasttrade<>1 THENEXITSHORT AT MARKETif trading>0 thenBUY 1 LOT AT MARKET nextbaropenendifENDIF// Condities om long posities te sluitenIF close<st AND lasttrade<>-1 THENSELL AT MARKETif trading>0 thenSELLSHORT 1 lot at market nextbaropenendifENDIF// Stops en targetsSET STOP $LOSS 150SET TARGET $PROFIT 150004/08/2016 at 1:46 PM #5097Dear 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
04/08/2016 at 5:02 PM #5110Hello 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 :
1st = SuperTrend[2.8,3]04/08/2016 at 9:28 PM #513704/11/2016 at 3:32 PM #523104/11/2016 at 3:54 PM #5232At 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/
-
AuthorPosts
Find exclusive trading pro-tools on