NexusFi: Find Your Edge


Home Menu

 





Buy/Sell in an indicator


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Mindset with 6 posts (0 thanks)
    2. looks_two toulouse-lautrec with 2 posts (1 thanks)
    3. looks_3 RJay with 2 posts (0 thanks)
    4. looks_4 DavidHP with 1 posts (0 thanks)
    1. trending_up 8,314 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

Buy/Sell in an indicator

  #1 (permalink)
 
Mindset's Avatar
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
Posts: 365 since Sep 2009
Thanks Given: 90
Thanks Received: 291

I always thought this was not possible.
But it is.
Can anybody explain HOW it's done - even just the basic concept would start me off!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 
DavidHP's Avatar
 DavidHP 
Isla Mujeres, MX
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Ninjatrader / Optimus Futures / AmpFutures
Trading: ES / 6E / 6B / CL
Frequency: Every few days
Duration: Minutes
Posts: 1,611 since Aug 2009
Thanks Given: 11,336
Thanks Received: 2,744

I'm not sure if this is what you are looking for but Rjay has modified this indicator to show bid/ask and level II.

It is in the download section of this site:


Follow me on Twitter Reply With Quote
  #3 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 683 since Jun 2009
Thanks Given: 758
Thanks Received: 787



Mindset View Post
I always thought this was not possible.
But it is.
Can anybody explain HOW it's done - even just the basic concept would start me off!

Mindset,

Last trade price equals = Close[0]

Volume of last trade equals = e.Volume


You can do something like this.
------------------------------------------------------------------

int theAsk = e.MarketData.Ask.Price;

int theBid = e.MarketData.Bid.Price;

if (e.Price >= theAsk) VolUp == e.Volume;
else if (e.Price <= theBid) VolDown == e.Volume;

-------------------------------------------------------------------

RJay

Reply With Quote
  #4 (permalink)
 
Mindset's Avatar
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
Posts: 365 since Sep 2009
Thanks Given: 90
Thanks Received: 291

Sorry - when I say Buy/Sell I mean EnterLong /EnterShort commands.

Started this thread Reply With Quote
  #5 (permalink)
 toulouse-lautrec 
Europe
 
Experience: Beginner
Platform: NinjaTrader
Posts: 73 since Jun 2009
Thanks Given: 13
Thanks Received: 53

never tried myself, but my guess is they are creating an OIF
(= order instruction file)
Ninja picks it up and fires away ....

Reply With Quote
Thanked by:
  #6 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 683 since Jun 2009
Thanks Given: 758
Thanks Received: 787


Mindset View Post
Sorry - when I say Buy/Sell I mean EnterLong /EnterShort commands.


You could try building some setups with strategy builder to see what the code looks like, then adapt it to your indicator?????

Reply With Quote
  #7 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623

hmmm... why would you need that in the first place?
Isn't strategy based on indicator result good enough?

Reply With Quote
  #8 (permalink)
 
Mindset's Avatar
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
Posts: 365 since Sep 2009
Thanks Given: 90
Thanks Received: 291

I have a basic set of "rules" that I like to trade but there is an element of discretion.
For instance if the potential profit is not enough I might pass on the trade altogether.

Secondly I can assess the trade with 2 or at most 3 mouse clicks - what I would like to do ( a la PositionSizer) is then be able to take those values and just pop in a buy/sell order with a target and a stop all on oco.

I can do it at the moment via a second set of charts ( strategies only) but that seems a bit lame - if NT provided a full and proper reference documentation it might be a whole lot easier!

The point of this thread is that up until I had seen position sizer - I didn't think it was possible AT ALL to get an order off from within an indicator. I have come from Tradestation ( 5 years ) and I must say "discovering" what NT can do and how to do it is very uneasy in comparison. I guess that is why this forum partly exists?

Plus I am wholly new to C# so sometimes it is all a little mysterious to me

toulouse - sorry what is an oif file - I have not heard of that.

Started this thread Reply With Quote
  #9 (permalink)
 toulouse-lautrec 
Europe
 
Experience: Beginner
Platform: NinjaTrader
Posts: 73 since Jun 2009
Thanks Given: 13
Thanks Received: 53

here you go, straight from the horses mouth ..... errr just copied from the help pages ...


File Interface
The file interface uses standard text files as input. These files are called order instruction files (OIF) and have specific format requirements. NinjaTrader processes the OIF the instant the file is written to the hard drive and subsequently deletes the file once the processing operation is complete.




there´s much more detail on the help pages about the syntax.
If you know how to open and write to a file from within an indicator you can create orders.

Scary isnt it? lol

Reply With Quote
  #10 (permalink)
 
Mindset's Avatar
 Mindset 
Singapore
 
Experience: Intermediate
Platform: NT
Broker: ib
Trading: MES
Posts: 365 since Sep 2009
Thanks Given: 90
Thanks Received: 291


Right ... so looking a little deeper into this I see that Tradestation users a dll called ntdirect.dll.
But you can only use this from an external application - not from within NT?

I tried the following for instance and get a using reference error

 
Code
   NinjaTrader.Client.Client NTClient = new NinjaTrader.Client.Client();
            int myPosition = NTClient.MarketPosition(@"FDAX 12-09", @"Sim101");
            txtMarketPosition.Text = myPosition.ToString();
it wants using System.NinjaTrader.Client but that doesn't work.

Started this thread Reply With Quote




Last Updated on October 8, 2009


© 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