thank u for the code. i need one help. i want to backtest some systems on amibroker. how to put stoploss for last 3 candle low for buy and vice versa for sell. but stoploss should be fixed not trailing.. please check below image..
This is something near to what I have been trying to achieve whole day. If your Buy/Short signals do not repeat until Sell/Cover signals are hit then you can just use this:
Code:
range = High - Low; //if this is what you meant by range
trg = BuyPrice + range;
cover = xcover or cross(trg, close); // xcover would be your original cover condition
But if the signals are coming on every candle it ruins your whole day. :annoyed: