Hello,
Is it possible to create a program in ProRealtime which uses the Hull Moving Average – Uptrend and Downtrend settings – to open and close orders automatically?
Thank you.
M
Yes, I use it a lot:
Period= 20 //for example
inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)
HULL = weightedaverage[round(sqrt(Period))](inner)
c1 = HULL > HULL[1] //uptrend
c2 = HULL < HULL[1] //downtrend
Thank you, much appreciated!
Something similar with a more complete code and explanation: Place orders when a curve change colour
I should have explained, c1 = HULL > HULL[1] in the above code only means that the Hull MA is rising; as a long entry condition it would buy at any point on that rising line.
If you want to enter only at the point where the Hull MA changes direction then you should use the code in Nicolas’ example:
c1 = HULL > HULL[1] and HULL[1]<HULL[2]//bullish turnaround
c2 = HULL < HULL[1] and HULL[1]>HULL[2]//bearish turnaround