Coding Moving crossing other Averages
- This topic has 5 replies, 2 voices, and was last updated 7 years ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Coding Moving crossing other Averages
Hi everyone,
I have problem with coding a line.
I want to BUY when the WilderAverage[1](close) crosses over Wilder Average[6] (close)[6]*1.0003 and then crosses over Wilder Average[6] (close)[6]*1.001, and after the first bull candle > than Wilder Average[6] (close)[6]*1.001
REM Conditions
entrylargo1 = WilderAverage[1](close) crosses over Wilder Average[6] (close)[6]*1.0003 AND crosses over Wilder Average[6] (close)[6]*1.001
entrylargo2 = (open<close) >Wilder Average[6] (close)[6]*1.001
I wrote:
IF NOT LONGONMARKET AND entrylargo1 AND entrylargo2 THEN
BUY 1 CONTRACT AT MARKET
But, nothing happens.
Any suggestions?
Thanks in advance,
Juan
AND in PRT is the logical AND and not the conjunction one uses in normal speech. So your condition could be:
1 2 3 4 |
IF close crosses over MA1 and close crosses over MA2... you can not write: If close crosses over MA1 and (implying the close) crosses over MA2... You have to repeat WHAT crosses over WHICH threshiold. |
Despair,
THANNNKKKKKSSSSS so much!!
It makes sense,
Juan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
DEFPARAM Cumulateorders = false // Indicadores WMprecio = WilderAverage[1](close) WM6mas2 = WilderAverage[6](close[6])*1.001 WM6mas1 = WilderAverage[6](close[6])*1.0003 WM6ceroazul = WilderAverage[6](close[6]) //WM6menos1 = WilderAverage[6](close[6])*0.9997 //WM6menos2 = WilderAverage[6](close[6])*0.999 // Entrada LARGO IF NOT LONGONMARKET AND WMprecio crosses over WM6ceroazul AND WMprecio crosses over WM6mas1 AND WMprecio crosses over WM6mas2 AND open>WM6mas2 AND close>open THEN BUY 1 CONTRACT AT MARKET ENDIF // Salida LARGO IF LONGONMARKET AND WMprecio crosses under WM6mas2 AND WMprecio crosses under WM6mas1 AND WMprecio crosses under WM6ceroazul THEN SELL AT MARKET ENDIF |
Hi Despair,
I did it like you said, but still nothing happens. Do you think that it has something to do with the fact that the Moving Average are 6 period forward???
I am attaching a portion of the code (the rest is incomplete), to see if anyone can see what is wrong in these lines.
Thanks in advance,
Juan
I think the problem is that all these requisites do not happen in the last candle. I have removed two of the three moving averages and I have one operation.
It seems like 1.crossing the average and 2. than last candle is a bullish/green and that 3. its close is above the average, all have to happen in the last candles.
Juan
I meant “in the last candle” (singular)
Find exclusive trading pro-tools on