Beginner needs some help with EMA cross strategy
Forums › ProRealTime English forum › ProOrder support › Beginner needs some help with EMA cross strategy
- This topic has 3 replies, 2 voices, and was last updated 7 years ago by Raul Vg.
-
-
02/16/2017 at 10:17 PM #25348
Hi all,
I’ve been trading a system manually for the two years and I’m delighted to say it’s made a profit. What I’ve been trying to do since discovering PRT is to code my manual system, but everything I’m trying isn’t replicating the manual process.
I’ve attached an image in the hope it’ll make my system a bit clearer, but I’ll explain below.
The manual system uses three EMA’s – 8, 200, 400 EMA.
- When the 8ema crosses over the 400ema we go long and when the 8 ema crosses back over the 200ema the long is exited.
- Once the 8 ema and price enters a “channel” between the 200-400ema no trade is taken – treat it like a no mans land.
- If price then pops back across the 200ema we go long again, hoping the trend will continue.
The opposite happens for a short position.
- If the 8ema moves out of the no trade zone and cross over the 400ema I go short
- If the 8ema then re enters the no trade zone and crosses back over either the 400ema or the 200ema the trade is exited.
Obviously the 200 and 400 switch around as the trend develops with the 200 eventually being the second closest ema as the trend in either direction establishes itself.
You can probably see why I’m struggling to code this now….
Any help coding this would be awesome as I’m pulling my hair out here 🙁
02/16/2017 at 11:38 PM #25353I suppose you were looking for something like this:
1234567891011121314151617181920212223242526272829303132333435363738// Definición de los parámetros del códigoDEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada// Condiciones para entrada de posiciones largasindicator1 = ExponentialAverage[8](close)indicator2 = ExponentialAverage[400](close)c1 = (indicator1 CROSSES OVER indicator2)IF c1 THENBUY 1 CONTRACT AT MARKETENDIF// Condiciones de salida de posiciones largasindicator3 = ExponentialAverage[8](close)indicator4 = ExponentialAverage[200](close)c2 = (indicator3 CROSSES UNDER indicator4)IF c2 THENSELL AT MARKETENDIF// Condiciones de entrada de posiciones cortasindicator5 = ExponentialAverage[8](close)indicator6 = ExponentialAverage[400](close)c3 = (indicator5 CROSSES UNDER indicator6)IF c3 THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Condiciones de salida de posiciones cortasindicator7 = ExponentialAverage[8](close)indicator8 = ExponentialAverage[200](close)c4 = (indicator7 CROSSES OVER indicator8)IF c4 THENEXITSHORT AT MARKETENDIF02/25/2017 at 3:17 PM #26346Hi all,
Thank you so much for you help! I really appreciate it. 🙂
Unfortunately I’m still struggling with this code :(. The code very kindly created above isn’t quiet right.
The system needs to re-enter a long or short position, if the 8ema moves back over the 200ema for a long or under again for a short. I’ve attached some examples to this thread which I hope may help me explain it a bit better.
Is it at possible to use pro real time to create an area between two moving average or a channel and create a “no trade area”?
02/25/2017 at 10:54 PM #263751234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253// Definición de los parámetros del códigoDEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada// Condiciones para entrada de posicionesindicator1 = ExponentialAverage[8](close)indicator2 = ExponentialAverage[200](close)indicator3 = ExponentialAverage[400](close)// buy conditions// buyc1 = (indicator1 CROSSES OVER indicator3)c2 = (indicator1 CROSSES OVER indicator2)//sellc3 = (indicator1 CROSSES UNDER indicator2)// sellshort conditions//sellc4 = (indicator1 CROSSES UNDER indicator3)c5 = (indicator1 CROSSES UNDER indicator2)//buyc6 = (indicator1 CROSSES OVER indicator2)// LARGEIF c1 or c2 and not onmarket THENBUY 1 CONTRACT AT MARKETENDIFIF c3 THENSELL AT MARKETENDIF// SHORTIF c4 or c5 and not onmarket THENSELLSHORT 1 CONTRACT AT MARKETENDIFIF c6 THENEXITSHORT AT MARKETENDIF1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on