Forums › ProRealTime English forum › ProOrder support › Placing order when HullMA changes from red to green › Reply To: Placing order when HullMA changes from red to green
11/08/2019 at 10:57 AM
#112399
I have changed the code to reflect suggestions. I have also removed all reference to other time frames – this code runs on one time frame only. I have also attached a new picture. Note that the green/red Hull MA is created by the platform indicators. The thin black line on top is the graphed Hull MA from the code. They overlap. I am still puzzled. This is from today’s data so should be able to be easily replicated by anyone pasting the code into their own platform.
Hull MA Red to Green
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
//Market: GBPUSD //Timeframe: 1h DEFPARAM CumulateOrders=False Period1=20 Period3=28 PositionSize = 1 //Calculate Hull Moving Average for Entry signal x1 = WeightedAverage[Period1](close) x2 = (2 * WeightedAverage[round(Period1/2)](close)) - x1 HullMA1 = WeightedAverage[round(sqrt(Period1))](x2) Bull1 = HullMA1 >= HullMA1[1] Bear1 = HullMA1 < HullMA1[1] If (Bull1 and Bear1[1]) then buy PositionSize contract at market //SET STOP pLOSS sl endif //Calculate Hull Moving Average for Exit signal y1 = WeightedAverage[Period3](close) y2 = (2 * WeightedAverage[round(Period3/2)](close)) - y1 HullMA3 = WeightedAverage[round(sqrt(Period3))](y2) //Bull3=HullAverage3>HullAverage3[1] Bear3 = HullMA3 < HullMA3[1] If Bear3 then sell at market endif graphonprice HullMA1 graphonprice HullMA3 |