Stop loss doesn't work for long position
Author: CarmaAdvisory
Creation Date: 11/11/2016 2:56 PM
profile picture

CarmaAdvisory

#1
Hi all, I am experiencing issues with stop loss signals for long positions (no problem with the short side).

In particular:
- stop loss is not applied in the backtest
- in the alerts page long stop losses signals have price = 0

This is my code (it worked properly few week ago):

CODE:
Please log in to see this code.


The strangeness is that I didn't modify my code.

Any suggestion?

Thank you

profile picture

Eugene

#2
Hi,

This code should not have worked neither a few weeks ago nor now:
CODE:
Please log in to see this code.


Position.AllPositions is not meant for returning EntryPrice and the code does not make sense. Could you clarify what exactly are you trying to do?
profile picture

CarmaAdvisory

#3
My apologies, I probably changed the code without realizing it:

the original code was:

CODE:
Please log in to see this code.


It works properly.

Thank you
profile picture

Eugene

#4
Glad you got it sorted out.
profile picture

Cone

#5
Tip:
Call PlotStops() just once anywhere in the script to visualize the limit and stop order prices on the chart. You have to look closely though, the dots are pretty small!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).