HULL Moving Average strategy
Forums › ProRealTime English forum › ProOrder support › HULL Moving Average strategy
- This topic has 15 replies, 4 voices, and was last updated 4 years ago by
howcar.
-
-
07/04/2020 at 8:33 PM #13842107/04/2020 at 10:48 PM #138426
There you go:
123456789Period=16x= 2*weightedaverage[ round( Period/2 ) ](close)-weightedaverage[Period](close)MHULL=weightedaverage[ round( sqrt(Period) ) ](x)If MHULL > MHULL[1] and not OnMarket thenBuy 1 contract at MarketEndifIf MHULL < MHULL[1] and not OnMarket thenSellshort 1 contract at MarketEndif1 user thanked author for this post.
07/05/2020 at 1:28 PM #138460Roberto
Thanks for the quick reply.
Unfortunately, I cannot get it to work.
In case I’m doing something wrong, this is what I have done.
- Pasted the code into a new ‘creation by programming’ box and clicked ‘ProBacktest my system’ – There were no trades/no results.
- Then used EURUSD with 2 Spread – No trades.
- Then changed the dates to 1/6/19 – 26/6/20 – No trades.
- Then changed the Period to 50 – Result: Only one entry in May 2020 and exit of that trade in June 20. The trades were not at colour changes but many candles away.
No other trades were taken for the year. - Shut down the platform completely and re-opened it.
- Pasted the code in fresh but now I can’t get it to take any trades, whatever parameters I use.
What I want is to have it exit on a color change and immediately open in the opposite direction because of that color change, non stop.
With a Taking Profit parameter and Stop Loss parameter.
As a PRT newbie, have I done anything wrong to prevent it working?
07/05/2020 at 1:40 PM #138461Sorry, my fault on detecting colour change.
Replace lines 4-9 with:
123456If MHULL > MHULL[1] and MHULL[1] < MHULL[2] and not OnMarket thenBuy 1 contract at MarketEndifIf If MHULL < MHULL[1] and MHULL[1] > MHULL[2] and not OnMarket thenSellshort 1 contract at MarketEndif1 user thanked author for this post.
07/05/2020 at 4:47 PM #13848007/05/2020 at 6:13 PM #138482You posted in ProBuilder and I did not pay attention to what you exactly wanted.
I moved your topic to ProOrder.
There you go:
123456789101112Defparam ComulateOrders = falsePeriod=16x= 2*weightedaverage[ round( Period/2 ) ](close)-weightedaverage[Period](close)MHULL=weightedaverage[ round( sqrt(Period) ) ](x)If MHULL > MHULL[1] and MHULL[1] < MHULL[2] and not OnMarket thenBuy 1 contract at MarketEndifIf If MHULL < MHULL[1] and MHULL[1] > MHULL[2] and not OnMarket thenSellshort 1 contract at MarketEndifSet Target pProfit 100Set Stop pLoss 5007/05/2020 at 7:22 PM #138484Thanks for that.
Sorry about posting in the wrong place – what with PRT/ TRADING.PRT / PRT.CODE / PRT ANALYSIS / ProOrder and ProBuilder!
I had difficulty getting access last week until the helpful lady at Support told me about the existence of PRT and TradingPRT and PRT Code and Green platforms and Blue platforms!
She said it was a common query from customers until they got used to the differences.The code is now taking multiple entries and exit orders.
But the entry/exit orders appear to be random.
EG. I set Period = 200, on a 4HR chart. This gave a color change on 29 May, followed by the next one on 14 June
Consequently, there should have been one exit (from previous trade) and one new entry on 29 May,
and one exit and a new entry on 14 June.What actually occurred was 7 entries and 7 exits (ie. 7 complete trades) during this period, instead of just one single trade
None of the trades was close to the color change.
07/05/2020 at 7:45 PM #138485Roberto
HOLD EVERYTHING!
Looks like my bad.
during testing I pasted the code with Default Period 16, and didn’t change it back to 200.
I will now have a strong cup of coffee, beat myself up and calmly test again much later tonight.
I will then report the outcome to you.
Thanks.
07/05/2020 at 9:05 PM #138493Green platforms and Blue platforms!
Being a curious guy … I’d love to know what these Green and Blue Platforms are? 🙂
Maybe I’ve been using PRT so long I can’t see it any more?? 🙂
07/06/2020 at 3:49 PM #138569Hi Roberto
There is still a problem.
To make it easier to see the problem, I set a very low Taking profit and very high Stop Loss, then ran the backtest.
USDCHF – H4 – Period 200 – TP20 – SL 300
Results: total 193 Trades – 180 wins(OK) and 13 Losses(not caused by SL)
All the high losses were caused by the trades not exiting at the color change. Instead, they all stayed open for many more bars in the next (wrong) period direction), then randomly closing.
If you quickly run your code on a backtest you will see this, by viewing the ‘Closed Positions List’, seeing the red losses and looking at them on the chart.
You can then see the entries have triggered but the exits didn’t, until many bars later.Hopefully, this will help you identify the fix.
Thanks.
07/06/2020 at 4:22 PM #138570It does NOT exit at a colour change because there were no provisions to!
This version will ALWAYS be on market, since it does Stop & Reverse on a colour change:
123456789101112Defparam ComulateOrders = falsePeriod=16x= 2*weightedaverage[round(Period/2)](close)-weightedaverage[Period](close)MHULL=weightedaverage[round(sqrt(Period))](x)If MHULL > MHULL[1] and MHULL[1] < MHULL[2] thenBuy 1 contract at MarketEndifIf If MHULL < MHULL[1] and MHULL[1] > MHULL[2] thenSellshort 1 contract at MarketEndifSet Target pProfit 100Set Stop pLoss 50you will change your TP & SL as best fits you.
1 user thanked author for this post.
07/06/2020 at 4:55 PM #138571I got attached if it’s of any interest Period = 16, TP = 400 and SL= 100
Spread = 4
1 user thanked author for this post.
07/06/2020 at 8:24 PM #13858907/06/2020 at 9:38 PM #13859707/06/2020 at 10:06 PM #138602You can change the border colours in the platform settings. I used to use this feature a lot when I had three accounts so I could tell the difference between each account and demo and live for each account when I had more than one platform open at the same time. Nothing worse than thinking you just closed a demo trade for a loss and then realising it was a live trade!
-
AuthorPosts
Find exclusive trading pro-tools on