Current price and MA or EMA

Hi @filip,
Is it possible to make the algo constantly check if price = MA then get out or get in, I cannot find how to get the price for some reason.

Yes. First calculate the MA just like we did in the video. Then would end up with something like this.

maSlow = sma(maSlowSource, maSlowLength)

Then you can do whatever you want using that and the current price, which you get from close.

if maSlow == close

or save it in a var and use it to take positions

enterpos = maSlow == close (this will be either true/false)

But keep in mind that this will almost never be true, because the moving average is almost never EXACTLY the same as the price. You should probably use crossover like we did in the video.