Stop-loss based on the previous CCI value

Created at 11 Nov 2021, 17:53
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!
V.

v.fiodorov83

Joined 24.07.2019

Stop-loss based on the previous CCI value
11 Nov 2021, 17:53


Hi.

I want to add the following functionality to my robot:

The robot opens a position at the current price.

The stop loss for this position is set at the price that was in the past the last CCI value above 200 or less.

 

Tell me how to implement it. Is it necessary to save the results of CCI to an array and compare the values in this array at the moment of opening a position?


@v.fiodorov83
Replies

amusleh
17 Nov 2021, 08:04

Hi,

Do you mean Commodity Channel Index? if that's what you meant by CCI then this indicator is available as a built-in indicator of cTrader and you can use it on your cBot like any other indicator.

Check here for an example: cAlgo API Reference - CommodityChannelIndex Interface (ctrader.com)


@amusleh