What object retrieves stop and target? - NinjaTrader Programming | futures io social trading
futures io futures trading


What object retrieves stop and target?
Updated: Views / Replies:382 / 18
Created: by Grantx Attachments:0

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Reply
 
Thread Tools Search this Thread
 

What object retrieves stop and target?

  #1 (permalink)
.
Reading UK
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Dorman. CQG.
Favorite Futures: CME
 
Grantx's Avatar
 
Posts: 325 since Oct 2016
Thanks: 208 given, 251 received

What object retrieves stop and target?

Im a little stuck here. If I enter an order with an ATM strategy, then what object do I need to instantiate so that I can retrieve the stop and target levels?

So far I have managed to get VS hooked into Ninja.
Successfully get it to stop in debug mode at OnExecutionUpdate()
However I dont know what object array is carrying the information I need.

Thanks

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 1,916 since Sep 2013
Thanks: 1,362 given, 2,878 received
Forum Reputation: Legendary


// have you looked at this ?

protected override void OnExecution(IExecution execution)
{
Print(execution.Order.LimitPrice);
Print(execution.Order.StopPrice);
}

Reply With Quote
The following user says Thank You to rleplae for this post:
 
  #4 (permalink)
.
Reading UK
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Dorman. CQG.
Favorite Futures: CME
 
Grantx's Avatar
 
Posts: 325 since Oct 2016
Thanks: 208 given, 251 received


rleplae View Post
// have you looked at this ?

protected override void OnExecution(IExecution execution)
{
Print(execution.Order.LimitPrice);
Print(execution.Order.StopPrice);
}

I tried it but compiler doesnt recognise it. I think that might be a NT7 interface. NT8 exposes the actual order object.

I foiund this page which Im scanning through:
NinjaTrader 8

Its been a while since Ive programmed though so this is going to take time .... and pain

Reply With Quote
 
  #5 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 1,916 since Sep 2013
Thanks: 1,362 given, 2,878 received
Forum Reputation: Legendary


Grantx View Post
I tried it but compiler doesnt recognise it. I think that might be a NT7 interface. NT8 exposes the actual order object.

I foiund this page which Im scanning through:
NinjaTrader 8

Its been a while since Ive programmed though so this is going to take time .... and pain

yes yes yes
i'm on 7 sorry

Reply With Quote
 
  #6 (permalink)
.
Reading UK
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Dorman. CQG.
Favorite Futures: CME
 
Grantx's Avatar
 
Posts: 325 since Oct 2016
Thanks: 208 given, 251 received

I think it would be something like this, I havent tested it thought my brain is starting to hurt. Will try this weekend. rleplae does it look right to you?

Order stopOrder;
double _pricestop = stopOrder.StopPrice

NinjaTrader 8

Reply With Quote
 
  #7 (permalink)
Elite Member
San Francisco, CA
 
Futures Experience: Advanced
Platform: IB-TWS, Ninja, Wave59, R
Broker/Data: IB, IQFeed
Favorite Futures: ZB
 
Posts: 34 since Sep 2013
Thanks: 0 given, 20 received

Look here. https://ninjatrader.com/support/helpGuides/nt8/en-us/order.htm

you have to define a variable first like this: private Order stopOrder1 = null;

then when you lace your order you can do it like this: stopOrder1 = ExitShortStopMarket(double stopPrice);

(you can find the order methods here: https://ninjatrader.com/support/helpGuides/nt8/en-us/order_methods.htm)

then you can access it like this: stopOrder1.StopPrice


Last edited by marpol; April 7th, 2017 at 04:16 PM. Reason: correct links and be more clear
Reply With Quote
 
  #8 (permalink)
.
Reading UK
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Dorman. CQG.
Favorite Futures: CME
 
Grantx's Avatar
 
Posts: 325 since Oct 2016
Thanks: 208 given, 251 received


marpol View Post
Look here. https://ninjatrader.com/support/helpGuides/nt8/en-us/

you have to define a variable first like this: private Order stopOrder1 = null;

then when you lace your order you can do it like this: stopOrder1 = "enter your order here";

then you can access it like this: stopOrder1.StopPrice

Im not sure what youve done there. Youre setting an order object to a string value?
Basically what I want to do is:

1. Create an event handler on executionupdate (or if there is a better way)
2. When the event is fired, instantiate an order object and retrieve the stop and limit levels.

My question is how do I get the current order object and what if its being managed by an atm strategy?

Reply With Quote
 
  #9 (permalink)
Elite Member
San Francisco, CA
 
Futures Experience: Advanced
Platform: IB-TWS, Ninja, Wave59, R
Broker/Data: IB, IQFeed
Favorite Futures: ZB
 
Posts: 34 since Sep 2013
Thanks: 0 given, 20 received


Grantx View Post
Im not sure what youve done there. Youre setting an order object to a string value?
Basically what I want to do is:

1. Create an event handler on executionupdate (or if there is a better way)
2. When the event is fired, instantiate an order object and retrieve the stop and limit levels.

My question is how do I get the current order object and what if its being managed by an atm strategy?

Ok so I am a little bit confused...kind of. So to start here is the NT8 Reference page for ATM in ninjascript https://ninjatrader.com/support/helpGuides/nt8/en-us/strategy.htm

1) If you put on the ATM strat then don't you know the stop and target levels?

2) It seams like most people use a ninjascript to enter a position and then (maybe) use an ATM strat as and exit.....it sounds like you want to do the opposite? (not that is wrong...just trying to understand).

3) I have never used and ATM stratagy ever before so I have never used them in an NT script. I am an approved NinjaTrader EcoSystem Partner so I can probably get an answer for you if I understand better.


So in NT8 the order info is stored in an order object. So you can define your own order object like I showed before: private Order myOrder1;

then if you use ninjasript to place a trade then you would do something like this: myOrder1 = "Place your Trade";
then the Order Object myOrder1 will point to that order so you can access it in your program. When I place stop orders in a NT script i always tell NT what the stop price should be....so I really never need to access myOrder1.StopPrice because i already know what i set it to in the first place.

Maybe if your ok with telling us what you are trying to do I/we can point you in the right direction. Or pm me if you need to make it private.

Reply With Quote
 
  #10 (permalink)
.
Reading UK
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: Dorman. CQG.
Favorite Futures: CME
 
Grantx's Avatar
 
Posts: 325 since Oct 2016
Thanks: 208 given, 251 received



marpol View Post
Ok so I am a little bit confused...kind of. So to start here is the NT8 Reference page for ATM in ninjascript https://ninjatrader.com/support/helpGuides/nt8/en-us/strategy.htm

1) If you put on the ATM strat then don't you know the stop and target levels?

2) It seams like most people use a ninjascript to enter a position and then (maybe) use an ATM strat as and exit.....it sounds like you want to do the opposite? (not that is wrong...just trying to understand).

3) I have never used and ATM stratagy ever before so I have never used them in an NT script. I am an approved NinjaTrader EcoSystem Partner so I can probably get an answer for you if I understand better.


So in NT8 the order info is stored in an order object. So you can define your own order object like I showed before: private Order myOrder1;

then if you use ninjasript to place a trade then you would do something like this: myOrder1 = "Place your Trade";
then the Order Object myOrder1 will point to that order so you can access it in your program. When I place stop orders in a NT script i always tell NT what the stop price should be....so I really never need to access myOrder1.StopPrice because i already know what i set it to in the first place.

Maybe if your ok with telling us what you are trying to do I/we can point you in the right direction. Or pm me if you need to make it private.

Hi Marpol,
Sorry Im not being very clear with what I am trying to achieve.
This is my first programming in a while so Im starting with something simple to get my head back into it.

At the moment, I do a screenshot after every trade has completed. I mark what my trade parameters were by drawing the entry, stop and target levels with a line. This helps my post analysis.
I want to speed up this process by automating the lines on the chart (with text showing the stop amount and target amount), so that when the trade is over all I have to do is quickly type in a brief analysis and then save the chart.

I really just need to get those levels and then my next step is figuring out how to draw a line on the chart at those levels.

Reply With Quote

Reply



futures io > > > > > What object retrieves stop and target?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Introducing iSystems with Stage 5 Trading

Apr 27

FIO Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

May

Prototyping Python Strategies (part 2) w/Ran Aroussi

Elite only

Ask Me Anything w/Raymond Deux @ NinjaTrader

May 3

An Afternoon with FIO member Softsoap

Elite only
 

Machine Learning & Data Mining Bias w/Kris Longmore @ Robot Wealth

Elite only

Brannigan Barrett (TBA)

Elite only

FIO member Gomi (TBA)

Elite only

FuturesTrader71 (TBA)

Elite only

EasyLanguage Programming w/Chris @ ABC Trading Group

Elite only

Portfolio Diversification w/Brendon Delate

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Object reference not set to an instance of an object. gomad NinjaTrader Programming 11 December 22nd, 2014 08:09 AM
Scalping with a target less than stop Twiddle Traders Hideout 19 November 20th, 2013 01:00 AM
OnBarUpdate Error Object reference not set to an instance of an object ECI Ed NinjaTrader Programming 2 August 6th, 2013 03:59 PM
Trailing stop and Target on Idicator Help bdd069 Elite Automated Trading 4 February 10th, 2013 07:38 PM
need help :: cant fix :: Object reference not set to an instance of an object Trader.Jon NinjaTrader Programming 9 November 3rd, 2010 10:55 AM


All times are GMT -4. The time now is 10:01 AM.

no new posts
Page generated 2017-04-28 in 0.14 seconds with 20 queries on phoenix via your IP 54.158.30.143