I'd like to create a strategy where a stop limit order is placed after a condition is met, then cancel this order X bars later if not filled. If it is filled, I'd like to trail the stop based upon the previous bar's close.
For example, on a long trade, after the condition is met, I'd like an order placed below the market. After X bars and not filled, cancel the order. If the order is filled, I'd like the stop to be set on the low of the previous bar, then trail up on the close with each bar.
Can someone give me a push in the right direction?
I hope someone more experienced can jump in here: I have seen conditions where the limit order was not accepted by the broker because it was too outside the bounds of the market activity, but, I cant recall the exact details. Thi is just offered for discussion, sorry I cant be more specific: I felt it might have a consideration in your design.
I have a strategy that uses a custom indicator. That indicator plots levels at which I want to enter with either a EnterLongStop() or a EnterShortStop(). I was having issues if Close was above the Long level, for example.
I did two things. The first got rid of 90% of the errors. Sample code:
The logic being if price has already moved above my LongEntryLevel, I don't want to submit a EnterLongStop order (though I might want a Limit order, which would require other code).
Alas 90% isn't good enough so I went back to the custom indicator and added a variable that I could access in the Strategy so that BOTH the indicator and the strategy were better hard wired to unambiguosly allow a long or a short. I tracked that issue through using print statements and found the indicator would sometimes allow the opposite of what I wanted and that would result in rejected orders.
The basis for the indicator upgrade code can be found here:
I am a very experienced trader, but not in using the Ninja format. Can you Autotrade in Ninja using a "ATR Trailing Stop" If so, can someone help me out and show me how to do it? I have searched all over the place and just can seem to find how, but I know it must be possible.
My set-up is just a onder thing and I have no problem programming that part of it, just want to be able to add an ATR Trailing stop as my stop out instead of a standard trailing stop.
just seen your question.
May be very late,
I tried to find about the same as you,
an ATR volatility stop.
Did you receive answer to your question.
If yes, did you receive it from BigMike forum.
And is it possible for me to get it.
If you didn't get answer.
I tried to find it on my side and can't.
But I found something could help you.
It's on ninjacators site.
Cost little buck, (around 97$)but if you can't find it free,
and if it's what you want.
They call "ATR trailing stop"