Perfect Trend Indicator with automatic trading
Forums › ProRealTime English forum › ProOrder support › Perfect Trend Indicator with automatic trading
- This topic has 17 replies, 2 voices, and was last updated 2 years ago by Mitchy14.
-
-
10/27/2017 at 1:31 PM #50722
Hi Nicolas, in order of your recommendation I´m writing here what I need to do for using your Perfect Trend indicator as an automatic trader. First of all, I want to operate in DAX Full Future in 1 minute, and I´ve made a list of paramethers that I wish it would have, for example:
- Open only longs
- Open longs when the blue dot gets on
- Limit: 5 points
- Stop: 5 points
- Close the operation if a red dot gets on
- Get a minimum of 20 points daily and a máximum of 24
- Maximum of operations daily: 150
- Schedule: From 8:00 to 17:00
Thank you very much.
Eduardo Siverio
1 user thanked author for this post.
10/27/2017 at 3:26 PM #50725When you speak English, it is obvious to open a thread in the English forum .. just saying it ..
This is the code of the strategy you asked for. I omit the MaxDaily profit which I don’t think it is useful in this case, make your own tests and tell us how it goes..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivateddefparam flatbefore = 080000defparam flatafter = 170000// --- settingsSlowLength = 7 // Slow lengthSlowPipDisplace = 0 // Slow pip displaceFastLength = 3 // Fast lengthFastPipDisplace = 0 // Fast pip displaceMinDailyProfit=20 //Max daily loss allowed (in points)// --- end of settingsthigh1 = Highest[SlowLength](high)+ SlowPipDisplace*pointsizetlow1 = Lowest[SlowLength](low)- SlowPipDisplace*pointsizethigh2 = Highest[FastLength](high)+ FastPipDisplace*pointsizetlow2 = Lowest[FastLength](low)- FastPipDisplace*pointsizeif barindex>2 thenif Close>line1[1] thenline1 = tlow1elseline1 = thigh1endifif Close>line2[1] thenline2 = tlow2elseline2 = thigh2endifendifif (Close[0]<line1[0] and Close[0]<line2[0]) thentrend = 1endifif (Close[0]>line1[0] and Close[0]>line2[0]) thentrend = -1endifif (line1[0]>line2[0] or trend[0] = 1) thentrena = 1endifif (line1[0]<line2[0] or trend[0] = -1) thentrena = -1endif//----// first time we launch the code, the trading is allowedonce TradeAllowed=1if intradaybarindex=0 thencount=0MyProfit=STRATEGYPROFITTradeAllowed=1endif// test if the strategyprofit of the day is currently above the daily profit allowedIf StrategyProfit>=MyProfit+(MinDailyProfit*POINTVALUE) thenTradeAllowed=0endifif TradeAllowed and trena<>trena[1] and trend=-1 and not onmarket and count<150 thenbuy 1 contract at marketendifif longonmarket and trend=1 thensell at marketendifif longonmarket and tradeindex<>lastindex thencount=count+1lastindex=tradeindexendifSET STOP PLOSS 5SET TARGET PPROFIT 510/27/2017 at 4:32 PM #50742Muchas gracias Nicolas y mil disculpas por lo del inglés, desconocía que estaba en el foro en español.
Una pregunta, me aparece un error de sintaxis en la fila 5, qué debo hacer para corregirlo?
Gracias
1 user thanked author for this post.
10/27/2017 at 7:35 PM #5075010/28/2017 at 3:38 PM #50782Sorry for the spanish.
I´m attaching the error the system gives me, I´ve tryed several times copying and pasteing the program but I can´t validate it. Also I´ve erased the symbol that is giving me the “error” and the thing became worse. When I downloaded your Perfect trend indicator was from an ITF file, I don´t know if it´s posible to have this code like an ITF file too to import it directly and avoid the copy/paste. Please excuse my ignorance in this subject.
Thank you
Eduardo Siverio
10/28/2017 at 4:03 PM #50784Totally odd, what is the “symbol” you erased that give you the error? There is no character at line 5!
Please try to delete the “añadir” variable that still exist (certainly from a previous code) in the optimisation settings.. Variable name can’t have accent, this is what may cause the problem here.
10/28/2017 at 4:34 PM #50787Well, I can´t see the symbol, but the space is being occuped by a ” ” (I´ve copied and pasted it, is between question marks), and it appears in lines 5, 13, 18, 31, 44, 53, 58 and 69 too. I erased everything and paste only the code, but it remains the “sintaxis error”. In the attachment you can see what it looks like.
10/28/2017 at 5:29 PM #5079010/28/2017 at 5:46 PM #50793Got it!
Thank you, on monday i`ll try it in demo.
11/03/2017 at 1:09 PM #51398Hi Nicolas,
I adjusted the limit and the stop in the backtest, I put Limit 6 and stop 8. The result in a walk forward was terrible. My idea was to earn 50 points per week, and between monday and wednesday I earned 28.5 points (not bad) but between thursday and friday I lost 51 points. The result is -22.5/week. My idea doesn´t works. So, If you have some recomendation to improve the code (or another code) I´ll be glad to read about it. Thank you for your time.
Eduardo
11/03/2017 at 3:53 PM #5142711/03/2017 at 3:56 PM #51432thank you again, I´ll try to improve it.
11/05/2017 at 10:59 AM #51554Hi Nicolas,
It´s posible to add a maximum daily loss to the code and a trailing stop of 1 point that activates when the value gets the target profit?
Thank you
Eduardo
11/05/2017 at 1:49 PM #51559A trailing stop of “only” 1 point should not work, it depends mainly of the allowed stop distance from price from your broker (and it’s different for every single security).
About a daily loss trigger, you have something already available in this blog post: https://www.prorealcode.com/blog/learning/max-profit-loss-day-trading-strategy/
11/05/2017 at 5:41 PM #51569thank you Nicolas
-
AuthorPosts
Find exclusive trading pro-tools on