Defining last price TP/SL
Created at 20 May 2019, 04:59
Defining last price TP/SL
20 May 2019, 04:59
Another simple one i cant figure out.
When my bot crosses EMA's i am trying to set the SL at the price of one of the EMA's.
private ExponentialMovingAverage _ema2;
_ema2 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 200);
var _sl = _ema2.Result.LastValue;
( i have also tried _ema2.Result.Last(0);)
ExecuteMarketOrder(TradeType.Buy, Symbol, 1000, null, _sl, 3.0)
it places the trade, but the SL is not at the EMA.
PanagiotisCharalampous
20 May 2019, 10:33
Hi zedodia,
The stop loss should be set in pips but you pass a price instead. You need to convert it into pips or use ModifyStopLossPrice after the position is opened.
Best Regards,
Panagiotis
@PanagiotisCharalampous