Fast Moving Average and Price Crossover
Forums › ProRealTime English forum › ProOrder support › Fast Moving Average and Price Crossover
- This topic has 6 replies, 2 voices, and was last updated 8 years ago by jbyrne.
-
-
07/04/2016 at 1:32 PM #10175
Hi, I have a system that uses heiken ashi candles and it will go long when the simple moving average(9) crosses a bullish candle and then closes and goes short when it crosses a bearish candle. I need any help making it as I’m having trouble doing so. It’s a pretty basic system and I’ve tried stuff like what you can see below but that doesn’t work. Please help.
12345678910111213141516171819202122232425262728293031323334353637383940// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsindicator1 = closeindicator2 = Average[9](close)c1 = (indicator1 CROSSES OVER indicator2)IF c1 THENBUY 500 PERPOINT AT MARKETENDIF// Conditions to exit long positionsindicator3 = closeindicator4 = Average[9](close)c2 = (indicator3 CROSSES UNDER indicator4)IF c2 THENSELL AT MARKETENDIF// Conditions to enter short positionsindicator5 = closeindicator6 = Average[9](close)c3 = (indicator5 CROSSES UNDER indicator6)IF c3 THENSELLSHORT 500 PERPOINT AT MARKETENDIF// Conditions to exit short positionsindicator7 = closeindicator8 = Average[9](close)c4 = (indicator7 CROSSES OVER indicator8)IF c4 THENEXITSHORT AT MARKETENDIF// Stops and targets07/04/2016 at 1:55 PM #1017807/04/2016 at 1:59 PM #1017907/04/2016 at 3:28 PM #10182Your code is catching correctly the moment when price are crossing the moving average. If you want to add a condition on the candlestick direction, you can code it like this:
12345678910bullish = close[1]>open[1]bearish = close[1]<open[1]IF c1 and bullish THENBUY 500 PERPOINT AT MARKETENDIFIF c3 and bearish THENSELLSHORT 500 PERPOINT AT MARKETENDIF07/04/2016 at 3:31 PM #10183Hi, thank you for your help it’s helped me a lot. I have realized that the problem i was having is that I use heiken ashi candles but ProOrder uses regular candlesticks. How can I get my code to buy/sell according to Heiken Ashi candles instead of regular candlesticks? thank you
07/04/2016 at 3:44 PM #1018807/04/2016 at 3:45 PM #10189 -
AuthorPosts
Find exclusive trading pro-tools on