Snippet of code to register bollinger band touch

Created at 26 Jul 2024, 16:33
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!
LE

leonwijeyesinghe

Joined 26.07.2024

Snippet of code to register bollinger band touch
26 Jul 2024, 16:33


Hello,

Is it possible to get a sample snippet for how to get my algo to recognise with the market touches a bollinger band?   

Thanks


@leonwijeyesinghe
Replies

firemyst
01 Aug 2024, 07:02 ( Updated at: 01 Aug 2024, 12:15 )

Here's pseudo code to help you with the top band. You can do something similar for the bottom.

If (

    (last price ≥ top bollinger band) and (current closing price ≤ top bollinger band)

    or

    (last price ≤ top bollinger band) and (current closing price ≥ top bollinger band)

)

{

   ///then you know it either touched or crossed

}


@firemyst