![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Oct 2008
Location: Western Australia
Posts: 80
Thanks: 0
Thanked 0 times in 0 posts
|
I have created a few systems using the wizard. Is there a way to display the initial stop and intial limit visually on the chart when the strategy enters a position? Is there a way also to display the trailing stop in real time?
Can you also assist with this piece of code? I wish to exit a long position by using a limit order one ATR(5) from my entry price. ExitLongLimit(ATR(5)[0],'''',""). I am not sure what to use to show entry price. Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Hi cptrader, to reference the entry price you can use 'Average Position Price' from the 'Strategy' category. Visualizing your stops would unfortunately need custom coding outside of the wizard.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Oct 2008
Location: Western Australia
Posts: 80
Thanks: 0
Thanked 0 times in 0 posts
|
ExitLongStop(Position.AvgPrice - ATR(5)[0] , "", "");
The above initial stop would be entry price less ATR(5). The ATR would be calculated on each new bar. Correct? How would I reference the ATR to the entry bar only? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
You would need to store the ATR value in a variable when you enter and then reference this in your order as offset for the stop.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Oct 2008
Location: Western Australia
Posts: 80
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for your feedback Bertrum
I am not entirely sure how to store the ATR value in a variable when you enter. I have included sample code with a stored ATR value of 5. private int aTRPeriod = 5; // Default setting for ATRPeriod {// Condition set 1 if (Low[0] > SMA(High, 10)[0]) { EnterLong(DefaultQuantity, "SMAabove"); } // Condition set 2 if (Position.MarketPosition == MarketPosition.Long) { ExitLongLimit(Position.AvgPrice + ATR(aTRPeriod)[0] , "SMAaboveExit", "SMAabove"); |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Hi cptrader, with storing I meant doing something like this
Code:
if (Position.MarketPosition == MarketPosition.Long)
{
double myATR = ATR(5)[0];
ExitLongLimit(Position.AvgPrice + myATR);
}
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Dec 2008
Location: Austin, TXs
Posts: 112
Thanks: 10
Thanked 0 times in 0 posts
|
Just to verify since I'm using simple profit and loss stops. Without doing code is there any way to plot say plus and minus 10% from the entry price lines on a chart?
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Unfortunately not bkout, you would need to create an indicator were you enter your entryprice and then you can calculate and display those levels.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HELP on Coding Stops&Limits w/ the STRATEGY WIZARD | Doctor D | General Programming | 3 | 04-02-2009 03:04 PM |
| Daily loss limits | SystemTrading | ATM Strategies (Discretionary Trading) | 1 | 03-05-2009 09:52 AM |
| Visual Stops | rtj4201 | Charting | 1 | 01-21-2009 08:58 AM |
| Test of difference within limits... | fy260498 | Strategy Development | 1 | 08-07-2008 11:01 PM |
| MAX/MIN limits | Richard Von | Indicator Development | 3 | 07-30-2007 08:29 AM |