Open at previous low

jackhpfilerrowson since: 26 Nov 2020;

  20 Feb 2021, 19:41
Open at previous low

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);

PanagiotisCharalampous's avatar

PanagiotisCharalampous since: 13 Jan 2017;

  22 Feb 2021, 08:14

Hi jackhpfilerrowson,

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

Best Regards,

Panagiotis 

Join us on Telegram

Head of Community Management at cTrader

jackhpfilerrowson since: 26 Nov 2020;

  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

PanagiotisCharalampous's avatar

PanagiotisCharalampous since: 13 Jan 2017;

  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

Head of Community Management at cTrader

marian.kosa since: 12 Feb 2021;

  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?