NexusFi: Find Your Edge


Home Menu

 





Semi-automatic trading


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one maxi with 9 posts (1 thanks)
    2. looks_two terratec with 5 posts (2 thanks)
    3. looks_3 monpere with 3 posts (1 thanks)
    4. looks_4 redratsal with 2 posts (0 thanks)
    1. trending_up 7,433 views
    2. thumb_up 4 thanks given
    3. group 7 followers
    1. forum 22 posts
    2. attach_file 3 attachments




 
Search this Thread

Semi-automatic trading

  #11 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


terratec View Post

So I use an indicator file (could also be a strategy), to have those declarations only once on my system and untouched for the day. In this file I just have the declarations of the variables, their standard values and some calculations like unrealized and realized P&L for all instruments etc.

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
Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Increase in trading performance by 75%
The Elite Circle
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #12 (permalink)
maxi
Rome, Italy
 
Posts: 17 since Jul 2010
Thanks Given: 2
Thanks Received: 1

terratec,

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?

Thanks.

Reply With Quote
  #13 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,371



maxi View Post
monpere:
The strategy is interfaced through a Global variable from an indicator, which sends command (ex: "Buy" ) as well as entry level and SL and PT levels. Entry order (in stop) is entered on button pressing, while the exit levels are activated only "On Execution".

If I use a single chart, everything works as expected, but, adding a second chart (different market), on execution of the entry order, TP and SL are not activated.

Strategies are both attached to any of the 2 charts, so I wouldn't see any reason for not working properly.

My idea is that the manual order could generate a bit of confusion and probably the variable should be "restarded".

I've already done a similar code through ATM and it worked, but that's easier because one has to create an ATM for any of the markets. The pity is that I need to have the number of shares/lots variable and this cannot be done with ATM.

terratec:

interesting idea, although my levels need to be changed often. What do you mean with a third file? A new indicator?

Thanks to all.

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.

Attached Thumbnails
Click image for larger version

Name:	cl.jpg
Views:	289
Size:	61.4 KB
ID:	101658  
Reply With Quote
Thanked by:
  #14 (permalink)
maxi
Rome, Italy
 
Posts: 17 since Jul 2010
Thanks Given: 2
Thanks Received: 1

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.

Reply With Quote
  #15 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,371


maxi View Post
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.

Attached Thumbnails
Click image for larger version

Name:	yy.jpg
Views:	254
Size:	75.9 KB
ID:	101662  
Reply With Quote
  #16 (permalink)
 terratec 
Zurich Switzerland
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: ES, 6E, CL
Posts: 403 since Sep 2009
Thanks Given: 64
Thanks Received: 515


maxi View Post
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?

Thanks.

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.

Reply With Quote
  #17 (permalink)
maxi
Rome, Italy
 
Posts: 17 since Jul 2010
Thanks Given: 2
Thanks Received: 1

Thanks to all for the answers.

I will think about them to find a better way to cope with this matter.

Reply With Quote
  #18 (permalink)
maxi
Rome, Italy
 
Posts: 17 since Jul 2010
Thanks Given: 2
Thanks Received: 1

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?

Am I missing something?

Thanks.

Reply With Quote
  #19 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090


maxi View Post
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?

Am I missing something?

Thanks.

Chart trader is active but the window is closed.


Visit my NexusFi Trade Journal Reply With Quote
  #20 (permalink)
 terratec 
Zurich Switzerland
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: ES, 6E, CL
Posts: 403 since Sep 2009
Thanks Given: 64
Thanks Received: 515



maxi View Post
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?

Am I missing something?

Thanks.

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.

Reply With Quote




Last Updated on November 3, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts