Hi! I wonder if you could help me with the code for en indicator.
I would like an indicator that meets the following conditions
1 . An 8 day exponential moving average crossing a 30 day exponential moving average
- The condition in point one shall be compared with the same condition last time it happened back in time.
If you compare the current crossing of the average, with the crossing of the average the time before, then the current close on price must be at least 0.5% higher.
If so, the indicator should show a 1, otherwise a 0
Would be thankful for help
Hi,
ema8=ExponentialAverage[8](close)
ema30=ExponentialAverage[30](close)
signal=0
if ema8 crosses over ema30 then
prevcross=latestcross
latestcross=close
signal= latestcross/prevcross>=1.005
endif
return signal
Woow, that was fast done. It seems to work perfect. thank you very much for the help.