I’m not sure yet whether it makes sense …
is there a filter / indicator that keeps my bot out of the market if it is too volatile? For example, when news triggers high price fluctuations in both directions. Can you filter that in order to stay away from the market, i.e. not trigger a trade?
You could make that filter yourself. Say some news make a spike, you can decide not to open a trade, no matter if your conditions are met, if the candle ‘s range is N times its average range over the last P periods.
Or if the high is greater than the previous bar by X%.
Could you please provide me with the code?
There you go:
AvgRange = average[20,0](range)
TradeOFF = range > (AvgRange * 2) //no trading if the current range > twice its average
// or
TradeOFF = ((1 - (high - high[1])) * 100) > 60 //no trading if high exceeded the previous high by 60%
then use TradeOFF to not enter a trade.
JSParticipant
Senior
Hi @phoentzs
You can also use the above with the volatility:
xVolatility = Std[n](Close)
or percentage
xPVolatility = (Std[n](Close) / Close) * 100
when the volatility is higher than x%, ensure that no trades are executed or close current trades.