Open at previous low

Created at 20 Feb 2021, 19:41
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!
JA

jackhpfilerrowson

Joined 26.11.2020

Open at previous low
20 Feb 2021, 19:41


Hi, I was wondering how I would set up a stop order so that it enters when the price goes beneath the last bars low.

I tried doing this but it seems to open where ever it wants

PlaceStopOrder(TradeType.Sell, SymbolName, 10000, Bars.LastBar.Low, "Order", SL, TP);

 

 


@jackhpfilerrowson
Replies

PanagiotisCharalampous
22 Feb 2021, 08:14

Hi jackhpfilerrowson,

You should use Bars.LowPrices.Last(1).

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

jackhpfilerrowson
22 Feb 2021, 22:32

RE:

PanagiotisCharalampous said:

Hi jackhpfilerrowson,

You should use Bars.LowPrices.Last(1).

Best Regards,

Panagiotis 

Join us on Telegram

Hi Panagiotis,

Thanks for the reply. I've tried that too but the bot still seems to execute the order at the open of the next bar. Also i there a way to set the SL as the High of the last bar and to determine the TP distance from the ATR?

Many thanks


@jackhpfilerrowson

PanagiotisCharalampous
23 Feb 2021, 08:41

Hi jackhpfilerrowson,

Can you share your source code and explain to us how to reproduce this behavior?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

marian.kosa
25 Feb 2021, 16:04

RE: RE:

Yes, You must remember that SL and TP are in pips. And bars are in actual price, and ATR is the change of price. To get pips from it you need to divide (or multiply?, i forgot) it by Symbol.PipSize or 10000.
At least that is what worked for me in SL and TP calculation.

jackhpfilerrowson said:

 

Also i there a way to set the SL as the High of the last bar and to determine the TP distance from the ATR?

 

 


@marian.kosa