modifystoplossprice to a specific price i.e low of previous candle

Created at 11 Jul 2020, 18:08
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!
SA

samuelbreezey

Joined 10.04.2019

modifystoplossprice to a specific price i.e low of previous candle
11 Jul 2020, 18:08


Hi all,

I was wondering if anyone could help with some coding or send me to where I can find the info:

I am wanting to move the stop loss price after each bar (therefore onBar) to the previous days low. How would this be possible?

Many thanks
Samuel


@samuelbreezey
Replies

PanagiotisCharalampous
13 Jul 2020, 09:29

Hi Samuel,

You can use ModifyStopLossPrice to do so.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

samuelbreezey
13 Jul 2020, 09:59

RE:

PanagiotisCharalampous said:

Hi Samuel,

You can use ModifyStopLossPrice to do so.

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you Panagiotis,

I'm sure that was how, thank you. Is there any sample coding? I am wanting to just set the stop loss to the EMA after each bar.

Many thanks
Sam


@samuelbreezey

PanagiotisCharalampous
13 Jul 2020, 10:51

Hi Sam,

Here is an example

            var ma = Indicators.SimpleMovingAverage(Bars.ClosePrices, 14);
            Positions[0].ModifyStopLossPrice(ma.Result.Last(1));

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

samuelbreezey
13 Jul 2020, 19:53

RE:

Thank you so much :)

 

PanagiotisCharalampous said:

Hi Sam,

Here is an example

            var ma = Indicators.SimpleMovingAverage(Bars.ClosePrices, 14);
            Positions[0].ModifyStopLossPrice(ma.Result.Last(1));

Best Regards,

Panagiotis 

Join us on Telegram

 


@samuelbreezey