NexusFi: Find Your Edge


Home Menu

 





What object retrieves stop and target?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Grantx with 10 posts (0 thanks)
    2. looks_two marpol with 4 posts (1 thanks)
    3. looks_3 rleplae with 2 posts (1 thanks)
    4. looks_4 sam028 with 1 posts (2 thanks)
    1. trending_up 3,808 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 18 posts
    2. attach_file 0 attachments




 
Search this Thread

What object retrieves stop and target?

  #1 (permalink)
 Grantx 
Reading UK
Legendary no drama Llama
 
Experience: None
Posts: 1,787 since Oct 2016
Thanks Given: 2,826
Thanks Received: 5,059

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

Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
Cheap historycal L1 data for stocks
Stocks and ETFs
Quantum physics & Trading dynamics
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
26 thanks
What is Markets Chat (markets.chat) real-time trading ro …
15 thanks
ApexTraderFunding.com experience and review
14 thanks
GFIs1 1 DAX trade per day journal
13 thanks
EG Indicators
11 thanks
  #3 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


// have you looked at this ?

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

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 Grantx 
Reading UK
Legendary no drama Llama
 
Experience: None
Posts: 1,787 since Oct 2016
Thanks Given: 2,826
Thanks Received: 5,059


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

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


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

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 Grantx 
Reading UK
Legendary no drama Llama
 
Experience: None
Posts: 1,787 since Oct 2016
Thanks Given: 2,826
Thanks Received: 5,059

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

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 marpol 
San Francisco, CA
 
Experience: Advanced
Platform: IB-TWS, Ninja, Wave59, R
Broker: IB, IQFeed
Trading: ZB
Posts: 37 since Sep 2013
Thanks Given: 0
Thanks Received: 26

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

Reply With Quote
  #8 (permalink)
 Grantx 
Reading UK
Legendary no drama Llama
 
Experience: None
Posts: 1,787 since Oct 2016
Thanks Given: 2,826
Thanks Received: 5,059


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?

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #9 (permalink)
 marpol 
San Francisco, CA
 
Experience: Advanced
Platform: IB-TWS, Ninja, Wave59, R
Broker: IB, IQFeed
Trading: ZB
Posts: 37 since Sep 2013
Thanks Given: 0
Thanks Received: 26


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)
 Grantx 
Reading UK
Legendary no drama Llama
 
Experience: None
Posts: 1,787 since Oct 2016
Thanks Given: 2,826
Thanks Received: 5,059



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.

Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on April 10, 2017


© 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