Extreme stop loss values
Extreme stop loss values
04 Mar 2024, 14:37
I have a problem with my cBot. It incorrectly calculates stop loss levels; when the stop loss should be 10$ below the current price, it ends up being 16000$ below (depending on the instrument).
This is how my bot is calculating stop loss:
[Parameter("Spread", DefaultValue = 10)] -------- it is used to add a value of spreed to stop loss
public double SL { get; set; }
protected override void OnBarClosed()
{
Case1: SL=MarketSeries.Low[index] - (Symbol.PipSize * SL);
Case2: SL=MarketSeries.Open[index] - (Symbol.PipSize * SL);
Case3: SL = MarketSeries.Low[index] + (Symbol.PipSize * SL); --------These are the only lines in code to calculate stop loss lvl
Case4: SL = MarketSeries.Close[index] - (Symbol.PipSize * 10);
ExecuteMarketOrder(TradeType.Buy, Symbol, InitialVolume, "Frann", SL, TP); — entering trade
}
PanagiotisCharalampous
05 Mar 2024, 06:46
Hi there,
SL and TP should be set in pips. You seem to pass absolute prices instead.
Best regards,
Panagiotis
@PanagiotisCharalampous