Stop Loss bug: AVP AND SuperTrend error

Bug details:

i have bot that has a stop loss when AVP lower than -5. Thats the only condition, and every thing seems to be working fine. 628 deals on a backtest and no losses greater than -5
backtest link Gainium app

Now i wanted to refine the stop loss and added an AND condition: AVP < -5 AND SuperTrend 1-10-01h (1hr Supertrend with a factor of 1) to make it a little more restrictive. If anything, with a more restrictive condition, we should have fewer deals. However, the back test came up very weird, the AVP at -5% is getting completely ignored and we have way more deals (811 now vs 628 previously)
Backtest link: Gainium app

Hello! We have received your bug report regarding the Stop Loss bug with AVP and SuperTrend error. Thank you for providing the detailed backtest links and screenshots; they will be very helpful for our investigation. We will update you shortly on this matter.

so i had a suspicion that once i added the AND, the AVP setting was getting completely ignored. I deleted the AVP condition and only ran it with SuperTrend enabled for the stop loss and the result was exactly identical to the AVP < -5 AND SuperTrend backtest, confirming my suspicion
link to the 3rd backtest, with Stop loss only with SuperTrend

Any chance this could be looked into so i can use more than the AVP indicator for stop loss conditions?

Looks like we missed this, will check today.

1 Like

Hello there! We’ve successfully resolved the issue where the AVP was being overlooked when other Stop Loss indicators were also active. This fix should ensure your stop-loss conditions, including your refined AVP and SuperTrend strategy, now function as intended. Please feel free to test your backtests again. Happy trading!

1 Like

i looked into it and its not completely fixed. The AVP indicator is still being ignored if we combine it using an OR function with SuperTrend (maybe other indicators too)

heres AVP alone

and heres SL on AVP ←5 OR SuperTrend1h moving from down to up

as you can see we have a few losses under -5% which shouldnt happen

This is when i use this format combining them with OR inside group 1

now if i combine them with OR outside the group, its the SuperTrend function that gets ignored

Should i start a new thread for this?

A stop loss can be executed below the configured distance. And conditions can increase the chance that it happens. If you combine two conditions with or then at least one of them must be met. If one of those is met more often, it’s likely that it will usually trigger the stop loss. If you combine conditions with and all have to be met. If one of them happen more rarely and especially in combination with the other, it’s likely that you will wait longer than the stop loss is triggered.

As I can see from your results, when using only AVP and AVP with OR results are the same. It shows that supertrend in SL has no effect. Position value under 5% happened before supertrand switch


When you added AND, bot waiting untill both will be true. It does mean position value can be anything under 5%, uncluding lower than 20%-40%

Thanks fior the reply Maksym. The issue is in both cases i was using OR, not AND, as can be in your screenshot. the only differnce between the cases, for testing purposes, is in the first i had Group 1 (AVP OR Supertrend) and in the 2nd i had Group 1 (AVP) OR Group 2 (supertrend)

.

Also, in the first case, since i am using OR as well (not AND), the stop loss should trigger exactly when AVP hits -5, regardless of what supertrend is doing

Hello there!

We’ve successfully identified and fixed the issue regarding the stop loss conditions in your bot’s backtest. The problem was related to how the system managed group and section indicator logic, affecting both the backtesting and live bot services. You should now see accurate results when you backtest your strategies with the refined stop loss settings.

Thank you for bringing this to our attention!

1 Like