PROBACKTEST strategy to code
Forums › ProRealTime English forum › ProOrder support › PROBACKTEST strategy to code
- This topic has 9 replies, 3 voices, and was last updated 8 years ago by tikitaka.
-
-
10/18/2016 at 9:18 AM #15091
Hi everyone! I need some help, please .. I would like to make a backtest code and a proorder with the following parameters:
Long operations:
– The closing of yesterday has to be higher than the opening of yesterday
– The closure before yesterday has to be less than the opening before yesterday
– The SMA 14 has to be on the rise
– The purchase order is executed when the price touch the maximum daily yesterday.
– Trailling stop 10%Short operations:
– The closing of yesterday has to be less than the opening of yesterday
– The closure before yesterday has to be higher than the opening before yesterday.
– The SMA must be downward
– The sell order is executed when the price touches the daily minimum today yesterday
– Trailing stop 10%Sorry about my englsih and thanks a lot in advance for your help!!
Nuria
10/18/2016 at 6:43 PM #15134Hi, girl. Yes, I’m sorry to say that your English is bad indeed. Let me rewrite the post for you in advanced English:
Hi everyone! I need some help, please: How can I learn to program this very easy to code strategy?I’m sure you’ll then help me with all my beginner’s errors. Thanks in advance!!‘Lazy’ NuriaBetter?10/18/2016 at 7:37 PM #1513610/19/2016 at 9:40 AM #1515810/19/2016 at 9:52 AM #15160Hi Nicolas!
Thanks for your patience! I get this strategy after tried on MT4, after long time, whit some mix of strategies from some books. I do that in Indices, TF: 1D, and it works fine, but I want to improve a little bit the strategy with Prorealtime. I tried to do it with the assistant but I can’t get how to put the bar of yesterday and befeore yesterday, and how to put conditioned. Also I don’t know how to put that the SMA 14 in green or red, like I have drawn on my graphic.
I will try until I get it! I would be grateful if you can help me.
Thanks a lot!!!
Nuria
10/22/2016 at 3:49 PM #15322This code is for long side only, I think you’ll have no difficulty to adapt it for short side by yourself:
123456789101112defparam cumulateorders = falseavg = average[14]long1 = close>openlong2 = close[1]<open[1]long3 = avg>avg[1]if long1 and long2 and long3 thenBUY 1 SHARE AT high STOPendifSET STOP %TRAILING 10The breakout of the yesterday’s high last only 1 bar.
10/25/2016 at 10:33 AM #15452Nicolas, thank you very much! I was tried to do the code for long side with the assistant to compare with your code, and I get it some different…
12345678910111213141516DEFPARAM CumulateOrders = Falseindicator1 = Average[14](close)indicator2 = Average[14](close)c1 = (indicator1 > indicator2[1])c2 = (DClose(0) > DOpen(0))c3 = (DClose(1) < DOpen(1))indicator3 = closec4 = (indicator3 = DHigh(0))IF c1 AND c2 AND c3 AND c4 THENBUY 1 SHARES AT MARKETENDIFSET STOP %LOSS 10Do you know if there is any lessons about the basics of the assistant?
Thanks a lot!!
Nuria
10/25/2016 at 12:33 PM #15468>> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
The result code from the assistant is pretty much the same, you use here the daily OHLC instead of the current timeframe ones. About the breakout (buy level) of the daily high on lines 10 and 11 you should use the crosses over instruction instead. Here you are testing if the current close is exactly the same as the daily high which is almost impossible to be true.
There is a video about how to create an automated trading strategy with the assistant in the blog.
10/26/2016 at 8:58 AM #1553710/26/2016 at 8:31 PM #15598 -
AuthorPosts
Find exclusive trading pro-tools on