Calgary + Alberta
Posts: 7 since Jul 2012
Thanks Given: 1
Thanks Received: 1
|
Hi guys, I'm trying to write a signal and I'm having troubles setting an initial stoploss as well as a trailing stop.
For long entries, I'd like the initial stop to be placed at the most recent swing low. For short entries, I'd like the initial stop to be placed at the most recent swing high.
As for the trailing stop, I'd like it to trail stops as a new swing low (long entries) or swing high (short entries) is formed.
The code that I have for long orders is:
If MarketPosition = 1 then begin
s_low = SwingLow(1, low, 2, 50);
Sell ("LE Stop") 1 contract next bar at s_low limit;
end;
Right now, that doesn't seem to be working at all, and I'm not really sure how else to go about it. I haven't found anywhere else that describes this. Any help would be appreciated.
Clark
|