If i open a long EUR trade in candle X at 1.1100, i want to set a stop at low price of candle X-1, which maybe 1.1075. I want the SL to be fixed at 1.1075, but when I post the SL as follows, it moves the stop value with each subsequent candle, whereas i want it to stay fixed at 1.1075, the price of the first Low. Any ideas?
When you create your order entry, define the stop like this:
That should work. The "Lowest" function takes the lowest of whatever value or variable you pass it over the number of bars you tell it. In my example, I told it I wanted the lowest value of the "Low" over the past 1 bar. You also want to make sure that your order entry code, and thus your stoploss definition, doesn't get redefined while you're in a position by using the "marketposition = 0" code so that your order entry criteria and stop loss definition only executes when the order is initially opened.
I've found it useful to create a ShowMe indicator which has identical entry criteria to my strategy and which displays the stop loss value as dots on the price chart. It makes it easier to see if things are behaving as you expect.