View Full Version : Set trailstop to 0?
funk101
04-29-2007, 07:16 PM
Is that valid? My inital trail stop is 12. However, if the order goes against my trade, can I set trailstop to zero? I want out *immediately*, I've tried ExitLong/Short() but I'm not happy with the fill. Right now I set to 1, I tried 0 seems to work, was wondering if that was just by chance.
NinjaTrader_Dierk
04-29-2007, 07:46 PM
Should work, we have not tested though.
NinjaTrader_Ray
04-30-2007, 01:19 AM
However, I would not suggest this approach since at a value of zero, the trail stop running with CalculateOnBarClose = false will trail the last traded price, there is an extremely high chance the trail stop will be modified to an invalid price and rejected by the exchange and possibly terminating your strategy due to an order generated error.
Ray
funk101
04-30-2007, 03:27 AM
So, what would be the best way out when I want out right at that moment?
NinjaTrader_Ray
04-30-2007, 03:40 AM
There is no choice but to go to Market via ExitLong/Short. Even if you could move the stop to a valid price, you will also get out at market so the exit price should be the same in both cases.
funk101
04-30-2007, 06:22 AM
Yeah, from my tests, ANYTHING but ExitLong/Short() yields a better fill. That shouldn't be I understand. This is with MarketReplay replay'd with the different settings each time.
NinjaTrader_Ray
04-30-2007, 06:26 AM
You could use SetProfitTarget() and modify this order's price below market when long in order to get filled right away. Just have an initial target price far outside since the only purppose for this is to exit the market quick.
Ray
funk101
04-30-2007, 06:30 AM
Ah! Didn't think of that one. I have a 30 point target(wishful thinking) built-in as it turns out. I'm gonna have-at-it! Thanks.
Why would SetProfitTarget fill better than ExitLong/ExitShort?
Would ExitLongLimit/ExitShortLimit work as well as SetProfitTarget?
KBJ
funk101
04-30-2007, 06:17 PM
Well, I'm trying this now, 'cause'n the other ain't workin'...could be me, not sure yet.
funk101
04-30-2007, 06:25 PM
Question, what is "fromEntrySignal"?
NinjaTrader_Dierk
04-30-2007, 06:35 PM
... refers to the entry signal which could be tagged like e.g. "Entry1". fromEntrySignal then could be "Entry1" to exit the position tagged by "Entry1".
funk101
04-30-2007, 06:39 PM
how's that diff. from "signalName"? ie:
EnterLongLimit(numContracts, Low[0], "mySignalName");
That's how my orders get entered.
so, ExitLongLimit(numContracts, Close[0], "mySignalname", ??);
where does "fromEntrySignal" get generated?
NinjaTrader_Dierk
04-30-2007, 06:51 PM
http://www.ninjatrader-support.com/HelpGuideV6/ExitLongLimit.html
Note: signal names are case sensitive: mySignalName!= mySignalname
funk101
04-30-2007, 07:00 PM
That was a typo. My question is, if you look at the help guide under EnterLongLimit() there is no overload that includes "fromEntrySignal", so, hence my question, where does that get assigned?...what am I missing?
NinjaTrader_Ray
05-01-2007, 01:00 AM
Its assigned in an Enter() method. Its the optional signal name you provide. Below is how you assign in an Enter() method and then reference it from an exit method.
EnterLong(string signalName)
ExitLong(string fromEntrySignal)
Ray
funk101
05-01-2007, 07:09 AM
Ok, I don't mean to be a hassle, but I am "hung up"on this one. Indulge me...
The syntax for entering...
1. EnterLongLimit(double limitPrice)
2. EnterLongLimit(double limitPrice, string signalName)
3. EnterLongLimit(int quantity, double limitPrice)
4. EnterLongLimit(int quantity, double limitPrice, string signalName)
The syntax for exiting...
1. ExitLongLimit(double limitPrice)
2. ExitLongLimit(int quantity, double limitPrice)
3. ExitLongLimit(double limitPrice, string fromEntrySignal)
4. ExitLongLimit(double limitPrice, string signalName, string fromEntrySignal)
5. ExitLongLimit(int quantity, double limitPrice, string signalName, string fromEntrySignal)
Where my mis-understanding lies is in the signalName vs fromEntrySignal. What you're telling me is they are *the same thing*? Then that would render the "Exit" syntax's 4 and 5(if you will) moot. Or, if I *am* missing something, then I ask you, how do you set the "fromEntrySignal" when it is *outside* the EnterLongLimit() method?
I see NO syntax like this -> EnterLongLimit(int quantity, double limitPrice, string signalName, string fromEntrySignal)
NinjaTrader_Ray
05-01-2007, 07:31 AM
Hi funk101,
Please read this.
http://www.ninjatrader-support.com/HelpGuideV6/Overview36.html
I am hoping that my documentation on this subject is clear.
Ray
funk101
05-01-2007, 07:52 AM
For me it's not clear. Never said I was a genius. I don't see in your documentation this syntax...:
EnterLongLimit(int quantity, double limitPrice, string signalName, string fromEntrySignal)
Understand? So, if I enter a trade like this:
string signalName = "mySignalName";
EnterLongLimit(numContracts, Close[0], signalName);
...and I want to exita trade like this:
ExitLongLimit(numContracts, Close[0], signalName, fromEntrySignal);
Where was "fromEntrySignal" defined? Because, as I can tell, "signalName" is my identifier to the trade. Are you telling me this...?
enter...:
string mySignalName = "yadayada";
EnterLongLimit(numContracts, Close[0], mySignalName);
exit...:
string myFromEntrySignal = "blahblah";
ExitLongLimit(numContracts, Close[0], mySignalName, myFromEntrySignal);
if *just* defined before exiting, well, then I don't understand, and I'll have to read over again to get it to sink in. What I see is signalName AND fromEntrySignal are trying to accomplish the same thing, to be an identifier to a trade.
kausti
05-14-2007, 05:51 PM
Hi funk101,
I am not with support staff. just another user. I am not sure if your issue was ever resolved satisfactorily. I thought I might have answer you are looking for.
so..
Let's say you have a custom strategy and multiple entry and exit conditions.
let's name them entry1, entry2 and exit1, exit2.
entry1 = EMA crossup
entry2 = MACD >0
exit1 = EMA crossdown
exit2 = MACD<0
Now, if first condition is met, your fromEntrySignal = "entry1" and signalName= "order1" for following entry :
EnterLongLimit(int quantity,double limitPrice, string signalName,string fromEntrySignal)
The reasoning behid this IMO is, fromEntrySignal tells you why you entered the trade and signalName is a way to name this particular order. If say, MACD>0 after sometime, you have
fromEntrySignal = "entry2" and signalName= "order2"
Now, while exiting positions, your fromEntrySignal is "exit1/2", which specifies why you are exiting and signalname is again the name for this particular exit. So when you look at the chart after closing positions, you know when, which orders were entered/exited and why so.
ExitLongLimit(numContracts, Close[0], SignalName, FromEntrySignal);
Again, my opinion is not "official". This is the way I thought it works.
hope it helps.
K
NinjaTrader_Ray
05-14-2007, 08:49 PM
K,
This is close to accurate.
One correction, there is no "fromEntrySignal" parameter for the method EnterLongLimit().
Its EnterLongLimit(int quantity, double limitPrice, string signalName). Only Exit() methods have a parameter "fromEntrySignal".
In a nutshell, Enter() methods take an optional parameter to "name" the order/signal. Exit() methods have an optional parameter that allow you to tie the exit method to a specific entry.