Coding Moving crossing other Averages
Forums › ProRealTime English forum › ProOrder support › Coding Moving crossing other Averages
- This topic has 5 replies, 2 voices, and was last updated 6 years ago by Juan Salas.
-
-
07/07/2017 at 1:55 PM #40025
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
07/07/2017 at 2:23 PM #40026AND in PRT is the logical AND and not the conjunction one uses in normal speech. So your condition could be:
1234IF 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.07/07/2017 at 2:49 PM #40027Despair,
THANNNKKKKKSSSSS so much!!
It makes sense,
Juan
07/07/2017 at 4:10 PM #4003812345678910111213141516171819DEFPARAM Cumulateorders = false// IndicadoresWMprecio = WilderAverage[1](close)WM6mas2 = WilderAverage[6](close[6])*1.001WM6mas1 = WilderAverage[6](close[6])*1.0003WM6ceroazul = WilderAverage[6](close[6])//WM6menos1 = WilderAverage[6](close[6])*0.9997//WM6menos2 = WilderAverage[6](close[6])*0.999// Entrada LARGOIF NOT LONGONMARKET AND WMprecio crosses over WM6ceroazul AND WMprecio crosses over WM6mas1 AND WMprecio crosses over WM6mas2 AND open>WM6mas2 AND close>open THENBUY 1 CONTRACT AT MARKETENDIF// Salida LARGOIF LONGONMARKET AND WMprecio crosses under WM6mas2 AND WMprecio crosses under WM6mas1 AND WMprecio crosses under WM6ceroazul THENSELL AT MARKETENDIFHi 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
07/07/2017 at 5:00 PM #40041I 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
07/07/2017 at 5:01 PM #40043I meant “in the last candle” (singular)
-
AuthorPosts
Find exclusive trading pro-tools on