A useful question for everyone

Created at 08 Aug 2020, 10:57
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
SA

samuel.jus.cornelio

Joined 19.03.2020

A useful question for everyone
08 Aug 2020, 10:57


Hello everyone, I'm on my next project now and I need a little help. I'm wondering how exactly I would encode an action that recognizes whether the bar has touched an indicator or not. I'm trying to code an EMA and I need to know if the current price is touching the EMA Thanks for an answer,


@samuel.jus.cornelio
Replies

firemyst
13 Aug 2020, 07:10

RE:

samuel.jus.cornelio said:

Hello everyone, I'm on my next project now and I need a little help. I'm wondering how exactly I would encode an action that recognizes whether the bar has touched an indicator or not. I'm trying to code an EMA and I need to know if the current price is touching the EMA Thanks for an answer,

This may involve rounding depending on what you consider "touching".

For example, using the PSAR. It's current value could be 1.4587357697 but the current "bid" or "ask" price could be 1.45873.

Is that touching or not?

You also have to determine if you consider if it should be the "bid" or "ask" (or perhaps both) values that touch the price.


@firemyst