Bot giving error when trying to put Position in Break Even
Bot giving error when trying to put Position in Break Even
25 May 2020, 17:40
Hey guys, how are u doing?
Im building a bot based on a strategy im studying and everythin was going fine until i fixed some order opening requirements.
My bot opens the order and after it profits an specific value the bot changes the stoploss to break even, and then starts to change to take profit.
But after the 3rd position the bot starts to give-me StopLossTakeProfit error i dont know why since the first 3 orders it worked well.
Thats the if where the error comes from:
if (botPosition.StopLoss.Value > botPosition.EntryPrice && lastClosePips > canalPips && tendencia == trend.Baixa && botPosition.TradeType.Equals(TradeType.Sell) && !breakEven)
{
newStopLoss = botPosition.EntryPrice - Symbol.PipSize * 1;
TradeResult tradeResult = ModifyPosition(botPosition, newStopLoss, 0);
Print(newStopLoss);
if (tradeResult.IsSuccessful)
{
Print("Sell stop loss to break even on: " + SymbolName + " - " + botPosition.Label);
}
else
{
Print("Sell stop loss to break even on: " + SymbolName + " - " + botPosition.Label + " - ERROR - " + tradeResult.Error.Value);
}
breakEven = true;
}
And the logs:
Thanks in advance
Replies
giogferrarizze
27 May 2020, 21:17
RE:
PanagiotisCharalampous said:
Hi giogferrarizze,
In order for somebody to help you, you need to provide the following.
1. The complete cBot code
2. cBot parameters and backtesting settings and dates that will allow us to reproduce this problem
Best Regards,
Panagiotis
Thank you for your response, thankfully i already figured it out!
@giogferrarizze
PanagiotisCharalampous
26 May 2020, 08:05
Hi giogferrarizze,
In order for somebody to help you, you need to provide the following.
1. The complete cBot code
2. cBot parameters and backtesting settings and dates that will allow us to reproduce this problem
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous