Stop-loss based on the previous CCI value
Created at 11 Nov 2021, 17:53
V.
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?
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