Topics
06 Jun 2022, 12:04
 1374
 7
18 May 2022, 09:37
 837
 3
13 May 2022, 17:02
 653
 2
09 May 2022, 11:40
 763
 2
Replies

hamijonz
20 Jun 2022, 23:13

amusleh said:

Hi,

You just have to iterate over a data series points with a loop and find the minimum or maximum values.

DateSeries itself has minimum and maximum extension methods: 

Minimum Method - cTrader Automate API

Maximum Method - cTrader Automate API

You can also use a for loop or Linq.

Hi, thank you, but I didn't mean that. I want to get it more precisely
And I don't want to get the maximum of ten previous candlesticks, for example, I just want to get the highest previous and the highest two previous ones
For example, I want to say that if the last value of RSI exceeds the previous highest point, open a buy position.
I hope you understand what I mean


@hamijonz

hamijonz
17 Jun 2022, 20:40 ( Updated at: 21 Dec 2023, 09:22 )

RE:

amusleh said:

Hi,

Can you post your cBot/Indicator code? so we how you tried to access the value.

Fractal is a lagging indicator, you can't access it's value unless you wait x number of bars based on your provided period value for the indicator.

Thanks for the replay
Honestly, I do not have a robot or indicator at the moment to give you the code
But let me try to understand what I mean in another way
Forget the fractal. Please tell me how to find these points(The lowest and highest points)
With what code can I call them?


@hamijonz

hamijonz
05 Jun 2022, 20:55 ( Updated at: 05 Jun 2022, 21:03 )

RE: thank you so much

amusleh said:

 

        private void MoveStopLossToProfit(Position position, double profitInPips)
        {
            var positionSymbol = Symbols.GetSymbol(position.SymbolName);

            var profitInPipsSize = positionSymbol.PipSize * profitInPips;

            var newStopLossPrice = position.TradeType == TradeType.Buy ?
                position.EntryPrice + profitInPipsSize :
                position.EntryPrice - profitInPipsSize;

            ModifyPosition(position, newStopLossPrice, position.TakeProfit);
        }

 

 


@hamijonz