Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I've even tried just making one switch/case statement, like so:
And then using:
Buy (nextlongname)
But same problem.
All result in the error posted above.
I am exploring other ways to get around this, but it seems like I must be doing something wrong.... surely this should work, yes?
The whole point of this is to granularly control a specific entry/exit point. I'm toying with using the PosTrade* reserve words but it would be far easier if I could just properly name the entries using a string.
Hi Mike
I had the same issue but with exits.
I wanted the exits in the report to properly reflect the reason for the exit.
I found the same issue, can't use strings in the sell order line.
So i ended up with the case statement style of thing like you.
Worse, I later found out that each name has to be unique. So in all the different sections of my code, I wanted Contract #1 to always be referred to as "LE" or "SE" then "#1" for example. But it won't let me do that, as I already used that name in the code.
And it won't let me apply a CurrentBar modifier to the string....
Pretty neat.
For now, I have worked around it using a whole slew of switch/case statements, adding over 400 lines of code to my strategy.
Hi Mike
I had the same issue.
What i did was use a variable early in the code and just one set of orders at the end.
How about i send you the code. Send me a pm with your email .
I did some extra testing right now and it seems named orders are not at all what I was expecting anyway.
I wanted to name an order so I could manipulate that specific order later, by name. But it is not possible (by name), because of the "order name already in use" thing I mentioned earlier.
So for now I am just using PosTrade* and OpenEntry* reserve words to try and identify orders. I will need to rethink all this, it seems much too difficult compared to what it should be. I've asked MultiCharts for help in case I am missing something obvious.
In MultiCharts the entries cannot be changed dynamically. They should be static from the very beginning of the script calculation in order to generate entries and exits properly.
The example script below shows the proper order naming routine:
MultiCharts - Raising the Trading Standard.
Please send me a private message if you have any further questions about MultiCharts
I encountered a similar issue - but it doesn't quite jive. I tried to set up an automatic scale out where it calculates the total order size divided by the number of units to be scaled out.
So then I encountered the unique name issue - tried using a String variable to name it, saw that it won't allow that. Tried the if/else or switch statement approach (or simply using NO name), and while that works, it only seems to do it once in my backtesting. basically, i have a catch-all in case the remaining quantity is too small to be divided in half.
When I backtest, my debug output says its issuing all the orders to sell, followed by the final. But no matter what I've tried, the chart and trade list will only show the first one, followed by the final one for the remaining size.
So my code confirms the strategy is working code-wise by outputing, for example:
Position Size: 100000
ScaleOut order #1 set for: 25000
Position Size: 75000
ScaleOut order #2 set for: 25000
Position Size: 50000
ScaleOut order #3 set for: 25000
Position Size: 25000
FINAL ScaleOut order set for: 25000
But on the chart, it will only show ScaleOut order #1 for 25000, then the next one will be the FINAL scaleout order, and for 75000!
Again, I believe I tried all the combinations of allowing multiple orders per bar. Is this some other limitation of intrabarorder generation?
I think Contract and Share are equivalent. SetStopContract is for the built-in stop though (which I am using for initial stop loss, but not for my custom trailing stop).
All that aside, I am not using stop orders (well I was, but then I changed it to market to see if that was the issue). So it's just a market order like this:
I was thinking maybe you cannot split one entry multiple times? So I could try issuing multiple order entries, but that would really not be ideal since there's a minimum commission at IB (basically 100,000 costs the same as 20,000 for forex). I realize I am splitting to less than ideal size when I exit, but I can live with that because it's for profit taking and also because I will ensure it's always trading full lots once I see it tested live more.
But perhaps that's the only way?
I worked with TradeStation a lot several years ago and I seem to remember being able to split one entry into multipel exits for stocks at that time, but, it was a long, long time ago.