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 can confirm that this method is reliable and works well, for method calls as well as variables. For example, I have used the approach to implement ring buffered centralised and throttled log messages and sounds, as well as indicator crosstalk.
That said, I implement all my work as multi-instrument indicators, I stopped using strategies when N7 allowed it and I only do discretionary non-backtest/non curve fit stuff so can't comment on any strategy specific issues.
I know N7 charting runs on a single thread but I take good care in all my other-world code to use the 'lock' primitive etc where needed (otherwise cores will be cores when you least expect it.)
The approach is currently unsupported by NinjaTrader for good reasons, I'm not sure how they handle the support load for such an open product and such a wide audience as it is, so I would suggest for use only by experienced programmers. I have been astonished at what is possible inside this beast And maybe even more for N8? Cripes.
Travel Well
Can you help answer these questions from other members on NexusFi?
I see your point and I think the method is very reliable.
Nevertheless I start from a different perspective, having 3 lines on the chart for entry/SL/TP that I move until I find the good combination in terms of risk/reward, then I press the button and the entry order is placed (from the line on chart). At this time the indicator has already embedded the SL level and the TP level (from the lines on chart), but only when the order is executed, the SL and TP are placed on the market.
So the global variable stores the entry/exit points that are passed to the strategy. I do not understand how to use a third file to do this.
One more question on your method:
You keep opened just one chart, with one strategy and two indicators, one for trading layout with buttons and other stuff and another with the global variable, switching among markets just by selecting the chart scrollbar on the left?
I use indicator/strategy communication using global variables as well. I disassociate my strategies from indicators by starting the strategies in the Strategies Tab, and do not attach strategies to the charts. I start one strategy for each instrument I trade. I generally trade Oil, Gold and SPY, so I start a strategy for each in strategies tab, then I can bring up any chart I want, or no chart at all, that will not affect any of the strategies.
When I press a button on any chart it sends a text string command such as "SPY, SellLimit 250 @ 162.92 +12-162.98~0=8 @1S-5 @2S-4 @3S-3 @3S-3 @4S-2 @6T+5 @6S+3 _NoFillBars_2 _NoFillTicks_3". The first parameter 'SPY' identifies which strategy the command is sent to. In reality, all the running strategies get the same command, but Gold and Oil strategies realize that the command is not meant for them, so they ignore the command. The SPY strategy realize the command is meant for it, so it processes the command and sends a response back. Similarly, all charts running the indicator sees responses from all strategies, but the charts also know to ignore any responses that is not meant for them. This way every thing is decoupled, everyone sees all messages, and only act on their own messages.
The decoupling means I can click a button on the chart, start the trade, and close the chart. All trade related processing is handled by the strategy. The part of the command string "@10S-5..." is my ATM specification, each tell the strategy how to manage the trade, i.e @ 10 ticks profit move stop to Entry-5 ticks, etc. Trade statistics are already fully calculated by strategies so if I need trades stats, I send the command "CL, stats", and the strategy responds with a string containing all the statistics I want.
This is what my chart looks like. The indicator only processes button clicks (and position sizing) and sends commands to the strategy. The strategy processes all trade related functions and statistics, that's what it was designed for, and all the strategy code should be fully supportable by NT support.
monpere, but are you using the ATM strategy to manage the trade, so you have an ATM for each market to be addressed?
Because using ATM could solve the matter but you have the limitation that you cannot change the number of lots (let's say for instance a 2% risk on my equity on the next trade) without changing the ATM strategy every time.
I don't use NT ATM strategies because they cannot do position sizing, and their functionality is limited, i.e only 3 conditions steps is allowed. I have a list of customized ATM's that can be chosen to manage any trade. If you look at my chart picture you will see a text field below the buttons, this is a drop down box with the specs for my various trade management types (customized ATM's text strings). I can choose a specific ATM in that drop down list, and the next time I send a trade command, that ATM spec will be sent along with the command. Near the top left corner of the chart you can see the full text of the currently chosen ATM command. Each "@..." entry in that text says @ x ticks profits do y. That includes move the target, or move the stop, or scale out, etc. I can have an unlimited number of these steps in the string. I had to do this because NT's ATM implementation is just too limited.
I am running one strategy for each instrument I intend to trade.
I can use one chart for all instruments by switching on the left side of the chart, or as many charts I want to use.
I can enter a trade in ES in the 5m timeframe, then go to CL placing an order there, switching to GC... going back to ES in a 3m timeframe and managing the trade.
To enter a trade I can use the method described, that is something like creating an ATM on the fly (as I dont like having 6 ATM's per instrument), or decoupling (detach button on the chart) the stuff and moving the black, red, and blue lines on the chart (post above) and then fire it.
As I said, I could place the code of the third file in the indy or strategy, but I have some advantages when changing timeframes etc. with using the third file.
terratec, I've seen on the picture you attached that the orders are visible on chart. It seems you are not using Chart Trader but a simple strategy to enter/manage trades, so how can the orders be visible without using Chart Trader?
maxi, to make it clear: my strategy is not linked to a chart.
I start all strategies in the tab. They are completely independent from charts. With the indicator on the chart (buttons) I send the commands, quantity, stops, targets etc. to the strategy of that instrument. And the strategy does send me infos back about account, P&L and whatever I want to know. In grosso modo it is the same way as described by monpere for his system a few post before.
And for your understanding (as I think my third file has some ??? for you):
The third file has not the function to store values. (As an extra it can do that). But it's job is to declare some variables.
NT does tolerate those declarations only once.
If I would do this in the strategy, I could not use the same strategy for different instruments at the same time. Same for the indicator in different charts at the same time.
When I would declare the variables in a chart, then values like highwater, total realized/unrealized would be reset every time when I switch the timeframe. That is also a reason that I place this indicator on a chart that I don't change during the day.